owner->view_state_changed();
}
goto exit_with_message;
- case LFUN_DOWN:
- if (view()->text->cursorRow() != view()->text->lastRow())
+ case LFUN_DOWN: {
+ LyXText * text = view()->text;
+ if (text->isLastRow(text->cursorPar(), *text->cursorRow()))
view()->text->cursorDown(view());
else
view()->text->cursorRight(view());
moveCursorUpdate();
owner->view_state_changed();
goto exit_with_message;
+ }
default:
break;
}
/// for example, the pos after which isNewLine(pos) == true
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;
+ /// sets row.witdh to the minimum space a row needs on the screen in pixel
+ void fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
/**
* returns the minimum space a manual label needs on the
// returns the minimum space a row needs on the screen in pixel
-int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
+void LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
{
- if (paper_width < 0) {
- lyxerr << "paperwidth < 0: " << paper_width << " Why?" << endl;
- return 0;
- }
-
int w;
// get the pure distance
pos_type const last = lastPos(*pit, row);
row.fill(0); // the minfill in leftMargin()
w = leftMargin(pit, row);
row.fill(tmpfill);
- } else
+ } else {
w = leftMargin(pit, row);
+ }
pos_type const body_pos = pit->beginningOfBody();
pos_type i = row.pos();
}
int const fill = paper_width - w - rightMargin(*pit, *bv()->buffer(), row);
-
- // If this case happens, it means that our calculation
- // of the widths of the chars when we do rowBreakPoint()
- // went wrong for some reason. Typically in list bodies.
- // Things just about hobble on anyway, though you'll end
- // up with a "fill_separator" less than zero, which corresponds
- // to inter-word spacing being too small. Hopefully this problem
- // will die when the label hacks die.
- if (lyxerr.debugging() && fill < 0) {
- lyxerr[Debug::GUI] << "Eek, fill() was < 0: " << fill
- << " w " << w << " paper_width " << paper_width
- << " right margin " << rightMargin(*pit, *bv()->buffer(), row) << endl;
- }
- return fill;
+ row.fill(fill);
+ row.width(paper_width - fill);
}
Row row(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);
- row.fill(f);
- row.width(w);
+ fill(pit, row, ww);
prepareToPrint(pit, row);
setHeightOfRow(pit, row);
row.y_offset(pit->height);
- pit->height += row.height();
pit->rows.push_back(row);
+ pit->width = std::max(pit->width, row.width());
+ pit->height += row.height();
}
height += pit->height;
//lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";