]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.cpp
Add a layout tag ForceOwnlines that assures an inset is started and terminated by...
[lyx.git] / src / insets / InsetText.cpp
index 346e00797961cd9134dfc9e55c9a6b6d9544c7b6..e0cd894a4ae95ebe1ccf9cdedbe513e2caeac698 100644 (file)
@@ -251,7 +251,6 @@ void InsetText::edit(Cursor & cur, bool front, EntryDirection entry_from)
        }
 
        text_.setCursor(cur.top(), pit, pos);
-       cur.clearSelection();
        cur.finishUndo();
 }
 
@@ -434,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
@@ -496,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;
 }
 
 
@@ -800,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);
 }
 
 
@@ -856,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));