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.
if (forward) {
cur.pos() += replacestr.length();
LASSERT(cur.pos() <= cur.lastpos(), /* */);
- } else {
- cur.pos() -= replacestr.length();
- LASSERT(cur.pos() >= 0, /* */);
}
if (findnext)
findOne(bv, searchstr, case_sens, whole, forward, false);