]> git.lyx.org Git - features.git/commitdiff
Fix the wrong cursor move when forward flag is false:
authorStephan Witt <switt@lyx.org>
Mon, 30 Jul 2012 12:32:29 +0000 (14:32 +0200)
committerStephan Witt <switt@lyx.org>
Mon, 30 Jul 2012 12:32:29 +0000 (14:32 +0200)
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.

src/lyxfind.cpp

index 73f6469754fe43b3ca2e903e6c893fac52491622..bd4e04e860e9825fdd4b0961402b792bc979c69e 100644 (file)
@@ -275,9 +275,6 @@ pair<bool, int> replaceOne(BufferView * bv, docstring searchstr,
        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);