X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetText.cpp;h=e0cd894a4ae95ebe1ccf9cdedbe513e2caeac698;hb=a25569ebb3e739779ff458b287e403c3bf79777a;hp=94ea92c12695dfc254fa65cdde766fee7e663ccf;hpb=5aede9597124b1a67abfd40521bc4984074ea413;p=lyx.git diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 94ea92c126..e0cd894a4a 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -251,7 +251,6 @@ void InsetText::edit(Cursor & cur, bool front, EntryDirection entry_from) } text_.setCursor(cur.top(), pit, pos); - cur.clearSelection(); cur.finishUndo(); } @@ -266,6 +265,18 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd) { LYXERR(Debug::ACTION, "InsetText::doDispatch(): cmd: " << cmd); + // See bug #9042, for instance. + if (isPassThru() && lyxCode() != ARG_CODE) { + // Force any new text to latex_language FIXME: This + // should only be necessary in constructor, but new + // paragraphs that are created by pressing enter at + // the start of an existing paragraph get the buffer + // language and not latex_language, so we take this + // brute force approach. + cur.current_font.setLanguage(latex_language); + cur.real_current_font.setLanguage(latex_language); + } + switch (cmd.action()) { case LFUN_PASTE: case LFUN_CLIPBOARD_PASTE: @@ -422,6 +433,8 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const // environment. Standard collapsable insets should not // redefine this, non-standard ones may call this. InsetLayout const & il = getLayout(); + if (il.forceOwnlines()) + os << breakln; if (!il.latexname().empty()) { if (il.latextype() == InsetLayout::COMMAND) { // FIXME UNICODE @@ -484,11 +497,13 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const os << breakln; else os << safebreakln; - os << "\\end{" << from_utf8(il.latexname()) << "}\n"; + os << "\\end{" << from_utf8(il.latexname()) << "}" << breakln; if (!il.isDisplay()) os.protectSpace(true); } } + if (il.forceOwnlines()) + os << breakln; } @@ -788,11 +803,11 @@ void InsetText::toString(odocstream & os) const } -void InsetText::forToc(docstring & os, size_t maxlen) const +void InsetText::forOutliner(docstring & os, size_t maxlen) const { if (!getLayout().isInToc()) return; - text().forToc(os, maxlen, false); + text().forOutliner(os, maxlen, false); } @@ -844,9 +859,9 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) cons tocstring = par.labelString(); if (!tocstring.empty()) tocstring += ' '; - arginset->text().forToc(tocstring, length); + arginset->text().forOutliner(tocstring, length); } else - par.forToc(tocstring, length); + par.forOutliner(tocstring, length); dit.pos() = 0; toc.push_back(TocItem(dit, toclevel - min_toclevel, tocstring, doing_output, tocstring));