]> git.lyx.org Git - features.git/commitdiff
Fix bug #6320: LyX goes to infinite loop when selecting document parts.
authorVincent van Ravesteijn <vfr@lyx.org>
Sun, 15 Nov 2009 22:01:12 +0000 (22:01 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 15 Nov 2009 22:01:12 +0000 (22:01 +0000)
Set the boundary member correctly when the cursor goes to an 'empty' row.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32034 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp

index 2a6d4e6420688226b4b3fe8b8f6644570c0ab230..14e31f922cd4731c8b8820f6c8379df5907b8400 100644 (file)
@@ -1914,8 +1914,16 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                }
                top().pos() = min(tm.x2pos(pit(), next_row, xo), top().lastpos());
 
-               boundary(tm.x2pos(pit(), next_row, xo) 
-                       == tm.x2pos(pit(), next_row, tm.width()));
+               int const xpos = tm.x2pos(pit(), next_row, xo);
+               bool const at_end_row = xpos == tm.x2pos(pit(), next_row, tm.width());
+               bool const at_beg_row = xpos == tm.x2pos(pit(), next_row, 0);
+
+               if (at_end_row && at_beg_row)
+                       // make sure the cursor ends up on this row
+                       boundary(false);
+               else
+                       boundary(at_end_row);
+
                updateNeeded |= bv().checkDepm(*this, old);
        }