From: Tommaso Cucinotta Date: Sun, 21 Mar 2010 10:36:59 +0000 (+0000) Subject: Fixed #2674 (Find and replace should restore initial cursor position), occurring... X-Git-Tag: 2.0.0~3745 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4bac24026d2499d5cb89a43db8d18cd0032884c9;p=lyx.git Fixed #2674 (Find and replace should restore initial cursor position), occurring on replace all. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33818 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index b615ff6983..987166411b 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -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; }