]> git.lyx.org Git - features.git/commitdiff
Fixed #2674 (Find and replace should restore initial cursor position), occurring...
authorTommaso Cucinotta <tommaso@lyx.org>
Sun, 21 Mar 2010 10:36:59 +0000 (10:36 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Sun, 21 Mar 2010 10:36:59 +0000 (10:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33818 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyxfind.cpp

index b615ff69838ed9cd7da853b39e3118848aa0862b..987166411b0cd79fc9a18890f8b81857162d9866 100644 (file)
@@ -171,6 +171,8 @@ int replaceAll(BufferView * bv,
        if (!searchAllowed(bv, searchstr) || buf.isReadonly())
                return 0;
 
+       DocIterator cur_orig(bv->cursor());
+
        MatchString const match(searchstr, cs, mw);
        int num = 0;
 
@@ -198,6 +200,10 @@ int replaceAll(BufferView * bv,
        bv->putSelectionAt(doc_iterator_begin(&buf), 0, false);
        if (num)
                buf.markDirty();
+
+       cur_orig.fixIfBroken();
+       bv->setCursor(cur_orig);
+
        return num;
 }