]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
Recompute Paragraph::beginOfBody() earlier
[lyx.git] / src / lyxfind.cpp
index 0a788c7ba85e6cf204cd8d71bda095db5f45b6da..d7038dedcb1e66d4bc96bb8e328e81dd26f295c1 100644 (file)
@@ -385,7 +385,6 @@ bool lyxreplace(BufferView * bv,
                else
                        bv->message(_("String not found."));
        }
-       bv->buffer().updatePreviews();
        return update;
 }
 
@@ -1008,7 +1007,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;
@@ -1072,8 +1070,8 @@ 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()) {
-                               WriteStream ws(ods);
+                       if (cs.asInsetMath() && cs.asInsetMath()->asHullInset()) {
+                               WriteStream ws(os);
                                cs.asInsetMath()->asHullInset()->header_write(ws);
                                break;
                        }
@@ -1095,7 +1093,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
                        CursorSlice const & cs = cur[s];
                        InsetMath * inset = cs.asInsetMath();
                        if (inset && inset->asHullInset()) {
-                               WriteStream ws(ods);
+                               WriteStream ws(os);
                                inset->asHullInset()->footer_write(ws);
                                break;
                        }
@@ -1299,6 +1297,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)))
@@ -1426,7 +1425,6 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
        LYXERR(Debug::FIND, "After pos adj cur=" << cur << " with depth: " << cur.depth() << " and len: " << sel_len);
        bv->putSelectionAt(DocIterator(cur), sel_len, !opt.forward);
        bv->processUpdateFlags(Update::Force);
-       bv->buffer().updatePreviews();
 }