From 8fd08e4ecebd37e25b6c5a04e47f33e3a99eeef8 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Sat, 16 Apr 2011 10:48:55 +0000 Subject: [PATCH] Nearly cosmetics. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38410 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxfind.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 02dc9ff07b..22e3b71f8f 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -1337,8 +1337,9 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M LYXERR(Debug::FIND, "Replacing by niceInsert()ing latex: '" << repl_latex << "'"); sel_len = cur.niceInsert(repl_latex); } - cur.pos() -= sel_len; - if (cur.pos() < 0) + if (cur.pos() >= sel_len) + cur.pos() -= sel_len; + else cur.pos() = 0; LYXERR(Debug::FIND, "Putting selection at cur=" << cur << " with len: " << sel_len); bv->putSelectionAt(DocIterator(cur), sel_len, !opt.forward); -- 2.39.2