]> git.lyx.org Git - lyx.git/commitdiff
Fixed and extended bug 1792 fix
authorMartin Vermeer <martin.vermeer@hut.fi>
Fri, 11 Mar 2005 14:20:58 +0000 (14:20 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Fri, 11 Mar 2005 14:20:58 +0000 (14:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9711 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index 7ada4a7a012543e391c1e2ac0d0fdab7d0824601..c435488d029c8edc824a3b5829016c9b1872ad63 100644 (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]
index 917808ec8395ef3fa0de90f9adcdbae024957eaf..053c292199e017f3bb7b8e6802ec4d5aec7c3c85 100644 (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();