mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 19:14:51 +00:00
Alfredo's cursroRow() fix;
directly set endpos in breakRowPos instead of returning it git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7970 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d42dd19a77
commit
cf40d206dc
@ -413,8 +413,7 @@ private:
|
|||||||
|
|
||||||
/// sets row.end to the pos value *after* which a row should break.
|
/// sets row.end to the pos value *after* which a row should break.
|
||||||
/// for example, the pos after which isNewLine(pos) == true
|
/// for example, the pos after which isNewLine(pos) == true
|
||||||
lyx::pos_type rowBreakPoint(ParagraphList::iterator pit,
|
void rowBreakPoint(ParagraphList::iterator pit, Row & row) const;
|
||||||
Row const & row) const;
|
|
||||||
|
|
||||||
/// returns the minimum space a row needs on the screen in pixel
|
/// returns the minimum space a row needs on the screen in pixel
|
||||||
int fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
int fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
||||||
|
27
src/text.C
27
src/text.C
@ -464,29 +464,34 @@ pos_type addressBreakPoint(pos_type i, Paragraph const & par)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
|
void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const
|
||||||
Row const & row) const
|
|
||||||
{
|
{
|
||||||
// maximum pixel width of a row.
|
// maximum pixel width of a row.
|
||||||
int width = workWidth() - rightMargin(*pit, *bv()->buffer(), row);
|
int width = workWidth() - rightMargin(*pit, *bv()->buffer(), row);
|
||||||
|
|
||||||
// inset->textWidth() returns -1 via workWidth(),
|
// inset->textWidth() returns -1 via workWidth(),
|
||||||
// but why ?
|
// but why ?
|
||||||
if (width < 0)
|
if (width < 0) {
|
||||||
return pit->size();
|
row.endpos(pit->size() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LyXLayout_ptr const & layout = pit->layout();
|
LyXLayout_ptr const & layout = pit->layout();
|
||||||
|
|
||||||
if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX)
|
if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
|
||||||
return addressBreakPoint(row.pos(), *pit);
|
row.endpos(addressBreakPoint(row.pos(), *pit) + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pos_type const pos = row.pos();
|
pos_type const pos = row.pos();
|
||||||
pos_type const body_pos = pit->beginningOfBody();
|
pos_type const body_pos = pit->beginningOfBody();
|
||||||
pos_type const last = pit->size();
|
pos_type const last = pit->size();
|
||||||
pos_type point = last;
|
pos_type point = last;
|
||||||
|
|
||||||
if (pos == last)
|
if (pos == last) {
|
||||||
return last;
|
row.endpos(last + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Now we iterate through until we reach the right margin
|
// Now we iterate through until we reach the right margin
|
||||||
// or the end of the par, then choose the possible break
|
// or the end of the par, then choose the possible break
|
||||||
@ -591,7 +596,7 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
|
|||||||
if (body_pos && point < body_pos)
|
if (body_pos && point < body_pos)
|
||||||
point = body_pos - 1;
|
point = body_pos - 1;
|
||||||
|
|
||||||
return point;
|
row.endpos(point + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1970,8 +1975,8 @@ void LyXText::redoParagraphInternal(ParagraphList::iterator pit)
|
|||||||
int const ww = workWidth();
|
int const ww = workWidth();
|
||||||
for (pos_type z = 0; z < pit->size() + 1; ) {
|
for (pos_type z = 0; z < pit->size() + 1; ) {
|
||||||
Row row(z);
|
Row row(z);
|
||||||
z = rowBreakPoint(pit, row) + 1;
|
rowBreakPoint(pit, row);
|
||||||
row.endpos(z);
|
z = row.endpos();
|
||||||
int const f = fill(pit, row, ww);
|
int const f = fill(pit, row, ww);
|
||||||
unsigned int const w = ww - f;
|
unsigned int const w = ww - f;
|
||||||
pit->width = std::max(pit->width, w);
|
pit->width = std::max(pit->width, w);
|
||||||
|
@ -285,6 +285,7 @@ void LyXText::cursorPrevious()
|
|||||||
|
|
||||||
LyXCursor cur;
|
LyXCursor cur;
|
||||||
ParagraphList::iterator pit = cursorPar();
|
ParagraphList::iterator pit = cursorPar();
|
||||||
|
rit = cursorRow();
|
||||||
previousRow(pit, rit);
|
previousRow(pit, rit);
|
||||||
setCursor(cur, parOffset(pit), rit->pos(), false);
|
setCursor(cur, parOffset(pit), rit->pos(), false);
|
||||||
if (cur.y() > bv_owner->top_y())
|
if (cur.y() > bv_owner->top_y())
|
||||||
@ -342,6 +343,7 @@ void LyXText::cursorNext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ParagraphList::iterator pit = cursorPar();
|
ParagraphList::iterator pit = cursorPar();
|
||||||
|
rit = cursorRow();
|
||||||
nextRow(pit, rit);
|
nextRow(pit, rit);
|
||||||
LyXCursor cur;
|
LyXCursor cur;
|
||||||
setCursor(cur, parOffset(pit), rit->pos(), false);
|
setCursor(cur, parOffset(pit), rit->pos(), false);
|
||||||
|
Loading…
Reference in New Issue
Block a user