]> git.lyx.org Git - features.git/commitdiff
Fix bug #6237: The boundary has to be set correctly when moving up with a selection...
authorVincent van Ravesteijn <vfr@lyx.org>
Thu, 5 Nov 2009 12:58:25 +0000 (12:58 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Thu, 5 Nov 2009 12:58:25 +0000 (12:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31863 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp

index d14fb45531c768d63f8a6dbf8b19be15b67f279e..d8362e21d9333fe0c80554d7f301dafb55fd9405 100644 (file)
@@ -1834,31 +1834,43 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                        operator=(dummy);
                }
        } else {
-               // if there is a selection, we stay out of any inset, and just jump to the right position:
+               // if there is a selection, we stay out of any inset,
+               // and just jump to the right position:
                Cursor old = *this;
+               int next_row = row;
                if (up) {
                        if (row > 0) {
-                               top().pos() = min(tm.x2pos(pit(), row - 1, xo), top().lastpos());
+                               --next_row;
+                               top().pos() 
+                                       = min(tm.x2pos(pit(), next_row, xo), top().lastpos());
                        } else if (pit() > 0) {
                                --pit();
                                TextMetrics & tm = bv_->textMetrics(text());
                                if (!tm.contains(pit()))
                                        tm.newParMetricsUp();
                                ParagraphMetrics const & pmcur = tm.parMetrics(pit());
-                               top().pos() = min(tm.x2pos(pit(), pmcur.rows().size() - 1, xo), top().lastpos());
+                               next_row = pmcur.rows().size() - 1;
+                               top().pos() 
+                                       = min(tm.x2pos(pit(), next_row, xo), top().lastpos());
                        }
                } else {
                        if (row + 1 < int(pm.rows().size())) {
-                               top().pos() = min(tm.x2pos(pit(), row + 1, xo), top().lastpos());
+                               ++next_row;
+                               top().pos() 
+                                       = min(tm.x2pos(pit(), next_row, xo), top().lastpos());                  
                        } else if (pit() + 1 < int(text()->paragraphs().size())) {
                                ++pit();
                                TextMetrics & tm = bv_->textMetrics(text());
                                if (!tm.contains(pit()))
                                        tm.newParMetricsDown();
-                               top().pos() = min(tm.x2pos(pit(), 0, xo), top().lastpos());
+                               next_row = 0;
+                               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()));
                updateNeeded |= bv().checkDepm(*this, old);
        }