]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
Correct early return position for if use_pixmap_cache_ check
[lyx.git] / src / lyxfind.cpp
index aedbc53bff0dd5d0bf52859e164b472b4752a40e..85b66d071588639d32e4447c9f0358897e016e04 100644 (file)
@@ -592,7 +592,6 @@ string escape_for_regex(string s, bool match_latex)
                }
                if (end_pos == s.size()) {
                        s.replace(new_pos, end_pos - new_pos, t);
-                       pos = s.size();
                        LYXERR(Debug::FIND, "Regexp after \\regexp{} removal: " << s);
                        break;
                }
@@ -1009,7 +1008,6 @@ docstring stringifyFromCursor(DocIterator const & cur, int len)
                pos_type end = ( len == -1 || cur.pos() + len > int(par.size()) ) ?
                        int(par.size()) : cur.pos() + len;
                OutputParams runparams(&cur.buffer()->params().encoding());
-               odocstringstream os;
                runparams.nice = true;
                runparams.flavor = OutputParams::LATEX;
                runparams.linelen = 100000; //lyxrc.plaintext_linelen;
@@ -1073,7 +1071,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
                // Retrieve the math environment type, and add '$' or '$[' or others (\begin{equation}) accordingly
                for (int s = cur.depth() - 1; s >= 0; --s) {
                        CursorSlice const & cs = cur[s];
-                       if (cs.asInsetMath() && cs.asInsetMath() && cs.asInsetMath()->asHullInset()) {
+                       if (cs.asInsetMath() && cs.asInsetMath()->asHullInset()) {
                                WriteStream ws(ods);
                                cs.asInsetMath()->asHullInset()->header_write(ws);
                                break;
@@ -1224,12 +1222,10 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv & match)
                return 0;
        cur.backwardPos();
        DocIterator cur_orig(cur);
-       bool found_match;
        bool pit_changed = false;
-       found_match = false;
        do {
                cur.pos() = 0;
-               found_match = match(cur, -1, false);
+               bool found_match = match(cur, -1, false);
 
                if (found_match) {
                        if (pit_changed)
@@ -1302,6 +1298,7 @@ static bool allNonLowercase(Cursor const & cur, int len)
        if (len > cur.lastpos() + 1 - beg_pos) {
                LYXERR(Debug::FIND, "This should not happen, more debug needed");
                len = cur.lastpos() + 1 - beg_pos;
+               end_pos = beg_pos + len;
        }
        for (pos_type pos = beg_pos; pos != end_pos; ++pos)
                if (isLowerCase(cur.paragraph().getChar(pos)))