mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Make pit_type unsigned (in particular, size_t).
This involves not just changing the type but checking that downward loops and similar tricks don't break.
This commit is contained in:
parent
7d36b9e4fa
commit
b9e2941847
@ -2860,7 +2860,7 @@ void BufferView::updateMetrics(Update::flags & update_flags)
|
|||||||
int y1 = d->anchor_ypos_ - anchor_pm.ascent();
|
int y1 = d->anchor_ypos_ - anchor_pm.ascent();
|
||||||
// We are now just above the anchor paragraph.
|
// We are now just above the anchor paragraph.
|
||||||
pit_type pit1 = d->anchor_pit_ - 1;
|
pit_type pit1 = d->anchor_pit_ - 1;
|
||||||
for (; pit1 >= 0 && y1 >= 0; --pit1) {
|
while (y1 >= 0) {
|
||||||
tm.redoParagraph(pit1);
|
tm.redoParagraph(pit1);
|
||||||
ParagraphMetrics & pm = tm.par_metrics_[pit1];
|
ParagraphMetrics & pm = tm.par_metrics_[pit1];
|
||||||
y1 -= pm.descent();
|
y1 -= pm.descent();
|
||||||
@ -2868,6 +2868,9 @@ void BufferView::updateMetrics(Update::flags & update_flags)
|
|||||||
pm.setPosition(y1);
|
pm.setPosition(y1);
|
||||||
tm.updatePosCache(pit1);
|
tm.updatePosCache(pit1);
|
||||||
y1 -= pm.ascent();
|
y1 -= pm.ascent();
|
||||||
|
if (pit1 == 0)
|
||||||
|
break;
|
||||||
|
--pit1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redo paragraphs below the anchor if necessary.
|
// Redo paragraphs below the anchor if necessary.
|
||||||
|
@ -881,10 +881,10 @@ void Compare::Impl::writeToDestBuffer(DocRange const & range,
|
|||||||
|
|
||||||
void Compare::Impl::writeToDestBuffer(ParagraphList const & pars) const
|
void Compare::Impl::writeToDestBuffer(ParagraphList const & pars) const
|
||||||
{
|
{
|
||||||
pit_type const pit = dest_pars_->size() - 1;
|
|
||||||
dest_pars_->insert(dest_pars_->end(), pars.begin(), pars.end());
|
dest_pars_->insert(dest_pars_->end(), pars.begin(), pars.end());
|
||||||
if (pit >= 0)
|
pit_type pit = dest_pars_->size();
|
||||||
mergeParagraph(dest_buf_->params(), *dest_pars_, pit);
|
if (pit > 0)
|
||||||
|
mergeParagraph(dest_buf_->params(), *dest_pars_, pit - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ RowPainter::RowPainter(PainterInfo & pi,
|
|||||||
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
|
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
|
||||||
//row_.dump();
|
//row_.dump();
|
||||||
|
|
||||||
LBUFERR(row.pit() >= 0);
|
LBUFERR(row.pit() < text.paragraphs().size());
|
||||||
LBUFERR(row.pit() < int(text.paragraphs().size()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ namespace lyx {
|
|||||||
*/
|
*/
|
||||||
// FIXME: should be unsigned as well.
|
// FIXME: should be unsigned as well.
|
||||||
// however, simply changing it breaks a downward loop somewhere...
|
// however, simply changing it breaks a downward loop somewhere...
|
||||||
typedef ptrdiff_t pit_type;
|
typedef size_t pit_type;
|
||||||
|
|
||||||
/// a type for the nesting depth of a paragraph
|
/// a type for the nesting depth of a paragraph
|
||||||
typedef size_t depth_type;
|
typedef size_t depth_type;
|
||||||
|
Loading…
Reference in New Issue
Block a user