The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 77bf805155609ad869238d5ab69eb325ee83b389
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Wed Apr 24 12:04:49 2013 +0200

    Fix bug #3199: change-next may leave empty lines behind
    
    Using Cursor::setCursor or even BufferView::setCursor is often a bad
    idea since it does not run DEPM. In this case (and other cases in
    f&replace code) it is better to use BufferView::mouseSetCursor (which
    should maybe be renamed...).

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index a01fbd6..3338c2f 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -417,20 +417,15 @@ bool findPreviousChange(BufferView * bv)
 
 bool findChange(BufferView * bv, bool next)
 {
-       if (bv->cursor().selection()) {
-               // set the cursor at the beginning or at the end of the 
selection
-               // before searching. Otherwise, the current change will be 
found.
-               if (next != (bv->cursor().top() > bv->cursor().normalAnchor()))
-                       bv->cursor().setCursorToAnchor();
-       }
-
-       DocIterator cur = bv->cursor();
+       Cursor cur(*bv);
+       cur.setCursor(next ? bv->cursor().selectionEnd()
+                     : bv->cursor().selectionBegin());
 
        // Are we within a change ? Then first search forward (backward),
        // clear the selection and search the other way around (see the end
        // of this function). This will avoid changes to be selected half.
        bool search_both_sides = false;
-       DocIterator tmpcur = cur;
+       Cursor tmpcur = cur;
        // Leave math first
        while (tmpcur.inMathed())
                tmpcur.pop_back();
@@ -449,8 +444,7 @@ bool findChange(BufferView * bv, bool next)
        if (!findChange(cur, next))
                return false;
 
-       bv->cursor().setCursor(cur);
-       bv->cursor().resetAnchor();
+       bv->mouseSetCursor(cur, false);
 
        CursorSlice & tip = cur.top();
 
@@ -478,12 +472,11 @@ bool findChange(BufferView * bv, bool next)
                }
        }
 
-       // Now put cursor to end of selection:
-       bv->cursor().setCursor(cur);
-       bv->cursor().setSelection();
-
-       if (search_both_sides) {
-               bv->cursor().setSelection(false);
+       if (!search_both_sides) {
+               // Now set the selection.
+               bv->mouseSetCursor(cur, true);
+       } else {
+               bv->mouseSetCursor(cur, false);
                findChange(bv, !next);
        }
 

-----------------------------------------------------------------------

Summary of changes:
 src/lyxfind.cpp |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to