static docstring buffer_to_latex(Buffer & buffer)
{
OutputParams runparams(&buffer.params().encoding());
+ TexRow texrow;
odocstringstream ods;
- otexstream os(ods);
+ otexstream os(ods, texrow);
runparams.nice = true;
runparams.flavor = OutputParams::LATEX;
runparams.linelen = 80; //lyxrc.plaintext_linelen;
// No side effect of file copying and image conversion
runparams.dryrun = true;
- buffer.texrow().reset();
pit_type const endpit = buffer.paragraphs().size();
for (pit_type pit = 0; pit != endpit; ++pit) {
- TeXOnePar(buffer, buffer.text(),
- pit, os, buffer.texrow(), runparams);
+ TeXOnePar(buffer, buffer.text(), pit, os, runparams);
LYXERR(Debug::FIND, "searchString up to here: " << ods.str());
}
return ods.str();
// plus the last subexpression, if a (.*?) was inserted in the constructor.
if (!braces_match(m[0].first, m[0].second, open_braces))
return 0;
- // Check braces on segments that matched all (.*?) subexpressions.
- for (size_t i = 1; i < m.size(); ++i)
+ // Check braces on segments that matched all (.*?) subexpressions,
+ // except the last "padding" one inserted by lyx.
+ for (size_t i = 1; i < m.size() - 1; ++i)
if (!braces_match(m[i].first, m[i].second))
return false;
// Exclude from the returned match length any length
TexRow texrow;
odocstringstream ods;
- otexstream os(ods);
+ otexstream os(ods, texrow);
OutputParams runparams(&buf.params().encoding());
runparams.nice = false;
runparams.flavor = OutputParams::LATEX;
pos_type endpos = cur.paragraph().size();
if (len != -1 && endpos > cur.pos() + len)
endpos = cur.pos() + len;
- TeXOnePar(buf, *cur.innerText(), cur.pit(), os, texrow, runparams,
+ TeXOnePar(buf, *cur.innerText(), cur.pit(), os, runparams,
string(), cur.pos(), endpos);
LYXERR(Debug::FIND, "Latexified text: '" << lyx::to_utf8(ods.str()) << "'");
} else if (cur.inMathed()) {
{
if (!cur)
return 0;
- while (!theApp()->longOperationCancelled() && cur) {
+ while (cur) {
LYXERR(Debug::FIND, "findForwardAdv() cur: " << cur);
if (match(cur, -1, false)) {
- for (; !theApp()->longOperationCancelled() && cur; cur.forwardPos()) {
+ for (; cur; cur.forwardPos()) {
LYXERR(Debug::FIND, "Advancing cur: " << cur);
if (match(cur)) {
// Sometimes in finalize we understand it wasn't a match
else
cur.backwardPos();
pit_changed = true;
- } while (!theApp()->longOperationCancelled());
+ } while (true);
return 0;
}
LYXERR(Debug::FIND, "After pasteParagraphList() cur=" << cur << endl);
sel_len = repl_buffer.paragraphs().begin()->size();
} else {
+ TexRow texrow;
odocstringstream ods;
- otexstream os(ods);
+ otexstream os(ods, texrow);
OutputParams runparams(&repl_buffer.params().encoding());
runparams.nice = false;
runparams.flavor = OutputParams::LATEX;
runparams.linelen = 8000; //lyxrc.plaintext_linelen;
runparams.dryrun = true;
- TexRow texrow;
- TeXOnePar(repl_buffer, repl_buffer.text(), 0, os, texrow, runparams);
+ TeXOnePar(repl_buffer, repl_buffer.text(), 0, os, runparams);
//repl_buffer.getSourceCode(ods, 0, repl_buffer.paragraphs().size(), false);
docstring repl_latex = ods.str();
LYXERR(Debug::FIND, "Latexified replace_buffer: '" << repl_latex << "'");