]> git.lyx.org Git - features.git/commitdiff
When only selecting the end_margin between 'after i-1' and 'before i', the
authorPavel Sanda <sanda@lyx.org>
Sat, 13 Sep 2008 23:03:33 +0000 (23:03 +0000)
committerPavel Sanda <sanda@lyx.org>
Sat, 13 Sep 2008 23:03:33 +0000 (23:03 +0000)
anchor is incorrectly set to be equal to the cur. This is because comparing two
CursorSlices does not take into account the boundary property (because the
CursorSlice does not know this).

Patch by Vincent.

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg143572.html

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

src/Cursor.cpp

index 70d31860f662fde0fb094a809f60eabbf2d5a24b..32c0ea0cf71349d9ad1ee5436e3da5be6ba5081f 100644 (file)
@@ -944,7 +944,14 @@ DocIterator Cursor::selectionBegin() const
 {
        if (!selection())
                return *this;
-       DocIterator di = (anchor() < top() ? anchor_ : *this);
+
+       DocIterator di;
+       // FIXME: This is a work-around for the problem that
+       // CursorSlice doesn't keep track of the boundary.
+       if (anchor() == top())
+               di = anchor_.boundary() > boundary() ? anchor_ : *this;
+       else
+               di = anchor() < top() ? anchor_ : *this;
        di.resize(depth());
        return di;
 }
@@ -954,7 +961,15 @@ DocIterator Cursor::selectionEnd() const
 {
        if (!selection())
                return *this;
-       DocIterator di = (anchor() > top() ? anchor_ : *this);
+
+       DocIterator di;
+       // FIXME: This is a work-around for the problem that
+       // CursorSlice doesn't keep track of the boundary.
+       if (anchor() == top())
+               di = anchor_.boundary() < boundary() ? anchor_ : *this;
+       else
+               di = anchor() > top() ? anchor_ : *this;
+
        if (di.depth() > depth()) {
                di.resize(depth());
                ++di.pos();