]> git.lyx.org Git - features.git/commitdiff
fix cursor movement (up/down) problem at the end of lines in insets and table cells.
authorBernhard Roider <bernhard.roider@sonnenkinder.org>
Sun, 13 May 2007 19:53:06 +0000 (19:53 +0000)
committerBernhard Roider <bernhard.roider@sonnenkinder.org>
Sun, 13 May 2007 19:53:06 +0000 (19:53 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18293 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text2.cpp

index c4f9af1d01050e014a16f10362318d0b0d3250da..9992d257c218843275bebf0a66913532f0583ea6 100644 (file)
@@ -991,10 +991,10 @@ bool Text::cursorUp(Cursor & cur)
        else
                row = pm.pos2row(cur.pos());
 
-       // remember current position only if we are not at the end of a row.
-       if (cur.pos() != pm.rows()[row].endpos())
-               cur.setTargetX();
-       int const x = cur.targetX();
+       int x = cur.targetX();
+       cur.setTargetX();
+       if (cur.pos() != pm.rows()[row].endpos() || x < cur.targetX())
+               x = cur.targetX();
 
        if (!cur.selection()) {
                int const y = bv_funcs::getPos(cur.bv(), cur, cur.boundary()).y_;
@@ -1050,10 +1050,10 @@ bool Text::cursorDown(Cursor & cur)
        else
                row = pm.pos2row(cur.pos());
 
-       // remember current position only if we are not at the end of a row.
-       if (cur.pos() != pm.rows()[row].endpos())
-               cur.setTargetX();
-       int const x = cur.targetX();
+       int x = cur.targetX();
+       cur.setTargetX();
+       if (cur.pos() != pm.rows()[row].endpos() || x < cur.targetX())
+               x = cur.targetX();
 
        if (!cur.selection()) {
                int const y = bv_funcs::getPos(cur.bv(), cur, cur.boundary()).y_;