diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 2e0ae40f0b..4914afb7cd 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -1111,7 +1111,7 @@ void pasteSelection(Cursor & cur, ErrorList & errorList) } -void replaceSelectionWithString(Cursor & cur, docstring const & str, bool backwards) +void replaceSelectionWithString(Cursor & cur, docstring const & str) { cur.recordUndo(); DocIterator selbeg = cur.selectionBegin(); @@ -1130,13 +1130,6 @@ void replaceSelectionWithString(Cursor & cur, docstring const & str, bool backwa // Cut the selection cutSelection(cur, true, false); - - // select the replacement - if (backwards) { - selbeg.pos() += str.length(); - cur.setSelection(selbeg, -int(str.length())); - } else - cur.setSelection(selbeg, str.length()); } diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index abaad3728d..c5c7aa4334 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -41,12 +41,9 @@ docstring selection(size_t sel_index); /** * Replace using the font of the first selected character and select - * the new string. When \c backwards == false, set anchor before - * cursor; otherwise set cursor before anchor. - * Does handle undo. + * the new string. Does handle undo. */ -void replaceSelectionWithString(Cursor & cur, docstring const & str, - bool backwards); +void replaceSelectionWithString(Cursor & cur, docstring const & str); /// If a selection exists, delete it without pushing it to the cut buffer. /// Does handle undo. void replaceSelection(Cursor & cur); diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index f90e530d82..73f6469754 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -271,7 +271,7 @@ pair replaceOne(BufferView * bv, docstring searchstr, if (bv->buffer().isReadonly()) return pair(false, 0); - cap::replaceSelectionWithString(cur, replacestr, forward); + cap::replaceSelectionWithString(cur, replacestr); if (forward) { cur.pos() += replacestr.length(); LASSERT(cur.pos() <= cur.lastpos(), /* */);