int y1 = d->anchor_ypos_ - anchor_pm.ascent();
// We are now just above the anchor paragraph.
pit_type pit1 = d->anchor_pit_ - 1;
- while (y1 >= 0) {
+ for (; pit1 >= 0 && y1 >= 0; --pit1) {
tm.redoParagraph(pit1);
ParagraphMetrics & pm = tm.par_metrics_[pit1];
y1 -= pm.descent();
pm.setPosition(y1);
tm.updatePosCache(pit1);
y1 -= pm.ascent();
- if (pit1 == 0)
- break;
- --pit1;
}
// Redo paragraphs below the anchor if necessary.
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());
- pit_type pit = dest_pars_->size();
- if (pit > 0)
- mergeParagraph(dest_buf_->params(), *dest_pars_, pit - 1);
+ if (pit >= 0)
+ mergeParagraph(dest_buf_->params(), *dest_pars_, pit);
}
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
//row_.dump();
- LBUFERR(row.pit() < text.paragraphs().size());
+ LBUFERR(row.pit() >= 0);
+ LBUFERR(row.pit() < int(text.paragraphs().size()));
}
}
-docstring bformat(docstring const & fmt, pit_type arg1)
-{
- LATTEST(contains(fmt, from_ascii("%1$d")));
- docstring const str = subst(fmt, from_ascii("%1$d"), convert<docstring>(arg1));
- return subst(str, from_ascii("%%"), from_ascii("%"));
-}
-
-
docstring bformat(docstring const & fmt, docstring const & arg1)
{
LATTEST(contains(fmt, from_ascii("%1$s")));
#define LSTRINGS_H
#include "support/docstring.h"
-#include "support/types.h"
#include <vector>
docstring bformat(docstring const & fmt, long long arg1);
#endif
docstring bformat(docstring const & fmt, unsigned int arg1);
-docstring bformat(docstring const & fmt, pit_type arg1);
docstring bformat(docstring const & fmt, docstring const & arg1);
docstring bformat(docstring const & fmt, char * arg1);
docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2);
*/
// FIXME: should be unsigned as well.
// however, simply changing it breaks a downward loop somewhere...
- typedef size_t pit_type;
+ typedef ptrdiff_t pit_type;
/// a type for the nesting depth of a paragraph
typedef size_t depth_type;