Fix the wrong cursor move when forward flag is false:

The forward flag is used to place the cursor behind the replaced text if it's true.
But it's not correct to move the cursor if it's false. The cursor is in front of the
replacement already after the replaceSelectionWithString() was done.
This commit is contained in:
Stephan Witt 2012-07-30 14:32:29 +02:00
parent 159108786d
commit 430cf3ee5e

View File

@ -275,9 +275,6 @@ pair<bool, int> replaceOne(BufferView * bv, docstring searchstr,
if (forward) { if (forward) {
cur.pos() += replacestr.length(); cur.pos() += replacestr.length();
LASSERT(cur.pos() <= cur.lastpos(), /* */); LASSERT(cur.pos() <= cur.lastpos(), /* */);
} else {
cur.pos() -= replacestr.length();
LASSERT(cur.pos() >= 0, /* */);
} }
if (findnext) if (findnext)
findOne(bv, searchstr, case_sens, whole, forward, false); findOne(bv, searchstr, case_sens, whole, forward, false);