]> git.lyx.org Git - features.git/commitdiff
After replacing with multi-cell contents, now advanced find and replace leaves the...
authorTommaso Cucinotta <tommaso@lyx.org>
Sun, 10 Jul 2011 00:19:11 +0000 (00:19 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Sun, 10 Jul 2011 00:19:11 +0000 (00:19 +0000)
Addressing http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg169981.html

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39266 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyxfind.cpp

index 486d10fe9ea950bc66237223f189caf884ea5df9..16527c02902435d236255a778125de41bcc8216c 100644 (file)
@@ -1377,14 +1377,18 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
                regex_replace(to_utf8(repl_latex), s, "\\$(.*)\\$", "$1");
                regex_replace(s, s, "\\\\\\[(.*)\\\\\\]", "$1");
                repl_latex = from_utf8(s);
-               LYXERR(Debug::FIND, "Replacing by niceInsert()ing latex: '" << repl_latex << "'");
-               sel_len = cur.niceInsert(repl_latex);
+               LYXERR(Debug::FIND, "Replacing by insert()ing latex: '" << repl_latex << "' cur=" << cur << " with depth=" << cur.depth());
+               MathData ar(cur.buffer());
+               asArray(repl_latex, ar, Parse::NORMAL);
+               cur.insert(ar);
+               sel_len = ar.size();
+               LYXERR(Debug::FIND, "After insert() cur=" << cur << " with depth: " << cur.depth() << " and len: " << sel_len);
        }
        if (cur.pos() >= sel_len)
                cur.pos() -= sel_len;
        else
                cur.pos() = 0;
-       LYXERR(Debug::FIND, "Putting selection at cur=" << cur << " with len: " << sel_len);
+       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();