/// sets row.end to the pos value *after* which a row should break.
/// for example, the pos after which isNewLine(pos) == true
- lyx::pos_type rowBreakPoint(ParagraphList::iterator pit,
- Row const & row) const;
+ void rowBreakPoint(ParagraphList::iterator pit, Row & row) const;
/// returns the minimum space a row needs on the screen in pixel
int fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
};
-pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
- Row const & row) const
+void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const
{
// maximum pixel width of a row.
int width = workWidth() - rightMargin(*pit, *bv()->buffer(), row);
// inset->textWidth() returns -1 via workWidth(),
// but why ?
- if (width < 0)
- return pit->size();
+ if (width < 0) {
+ row.endpos(pit->size() + 1);
+ return;
+ }
LyXLayout_ptr const & layout = pit->layout();
- if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX)
- return addressBreakPoint(row.pos(), *pit);
+ if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
+ row.endpos(addressBreakPoint(row.pos(), *pit) + 1);
+ return;
+ }
pos_type const pos = row.pos();
pos_type const body_pos = pit->beginningOfBody();
pos_type const last = pit->size();
pos_type point = last;
- if (pos == last)
- return last;
+ if (pos == last) {
+ row.endpos(last + 1);
+ return;
+ }
// Now we iterate through until we reach the right margin
// or the end of the par, then choose the possible break
if (body_pos && point < body_pos)
point = body_pos - 1;
- return point;
+ row.endpos(point + 1);
}
int const ww = workWidth();
for (pos_type z = 0; z < pit->size() + 1; ) {
Row row(z);
- z = rowBreakPoint(pit, row) + 1;
- row.endpos(z);
+ rowBreakPoint(pit, row);
+ z = row.endpos();
int const f = fill(pit, row, ww);
unsigned int const w = ww - f;
pit->width = std::max(pit->width, w);
LyXCursor cur;
ParagraphList::iterator pit = cursorPar();
+ rit = cursorRow();
previousRow(pit, rit);
setCursor(cur, parOffset(pit), rit->pos(), false);
if (cur.y() > bv_owner->top_y())
}
ParagraphList::iterator pit = cursorPar();
+ rit = cursorRow();
nextRow(pit, rit);
LyXCursor cur;
setCursor(cur, parOffset(pit), rit->pos(), false);