Fixed and extended bug 1792 fix

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9711 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2005-03-11 14:20:58 +00:00
parent 208c57fad7
commit 68237d3c48
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2005-03-11 Martin Vermeer <martin.vermeer@hut.fi>
* text2.C: fixed the fix, extended to other case.
2005-03-08 Martin Vermeer <martin.vermeer@hut.fi>
* text2.C: fix for cursor up/down stuck in math [bug 1792]

View File

@ -803,6 +803,12 @@ pos_type LyXText::getColumnNearX(pit_type const pit,
}
}
// The following code is necessary because the cursor position past
// the last char in a row is logically equivalent to that before
// the first char in the next row. That's why insets causing row
// divisions -- Newline and display-style insets -- must be treated
// specially, so cursor up/down doesn't get stuck in an air gap -- MV
// Newline inset, air gap below:
if (row.pos() < end && c >= end && par.isNewline(end - 1)) {
if (bidi.level(end -1) % 2 == 0)
tmpx -= singleWidth(par, end - 1);
@ -810,11 +816,16 @@ pos_type LyXText::getColumnNearX(pit_type const pit,
tmpx += singleWidth(par, end - 1);
c = end - 1;
}
if (row.pos() < end && c >= end
// Air gap above display inset:
if (row.pos() < end && c >= end && end < par.size()
&& par.isInset(end) && par.getInset(end)->display()) {
c = end - 1;
}
// Air gap below display inset:
if (row.pos() < end && c >= end && par.isInset(end - 1)
&& par.getInset(end - 1)->display()) {
c = end - 1;
}
x = int(tmpx) + xo;
return c - row.pos();