]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
tex2lyx/text.cpp: whitespace fix
[lyx.git] / src / lyxfind.cpp
index 081fae8ad0368d89d26682a75001e7311906f914..73f6469754fe43b3ca2e903e6c893fac52491622 100644 (file)
@@ -271,7 +271,7 @@ pair<bool, int> replaceOne(BufferView * bv, docstring searchstr,
        if (bv->buffer().isReadonly())
                return pair<bool, int>(false, 0);
 
-       cap::replaceSelectionWithString(cur, replacestr, forward);
+       cap::replaceSelectionWithString(cur, replacestr);
        if (forward) {
                cur.pos() += replacestr.length();
                LASSERT(cur.pos() <= cur.lastpos(), /* */);
@@ -1133,12 +1133,12 @@ int findForwardAdv(DocIterator & cur, MatchStringAdv & match)
 {
        if (!cur)
                return 0;
-       while (cur) {
+       while (!theApp()->longOperationCancelled() && cur) {
                LYXERR(Debug::FIND, "findForwardAdv() cur: " << cur);
                int match_len = match(cur, -1, false);
                LYXERR(Debug::FIND, "match_len: " << match_len);
                if (match_len) {
-                       for (; cur; cur.forwardPos()) {
+                       for (; !theApp()->longOperationCancelled() && cur; cur.forwardPos()) {
                                LYXERR(Debug::FIND, "Advancing cur: " << cur);
                                int match_len = match(cur);
                                LYXERR(Debug::FIND, "match_len: " << match_len);
@@ -1235,7 +1235,7 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv & match) {
                else
                        cur.backwardPos();
                pit_changed = true;
-       } while (true);
+       } while (!theApp()->longOperationCancelled());
        return 0;
 }
 
@@ -1348,7 +1348,7 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
                }
        }
        cap::cutSelection(cur, false, false);
-       if (!cur.inMathed()) {
+       if (cur.inTexted()) {
                repl_buffer.changeLanguage(
                        repl_buffer.language(),
                        cur.getFont().language());
@@ -1359,7 +1359,7 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
                                        bv->buffer().errorList("Paste"));
                LYXERR(Debug::FIND, "After pasteParagraphList() cur=" << cur << endl);
                sel_len = repl_buffer.paragraphs().begin()->size();
-       } else {
+       } else if (cur.inMathed()) {
                TexRow texrow;
                odocstringstream ods;
                otexstream os(ods, texrow);