]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
cleanup and reorder initialisation code of GuiView and GuiToolbars. Move some things...
[lyx.git] / src / Text.cpp
index 2339b2bef27667a1d4dc5148ac488b5153ec3a86..0af0731f89187a3e953f2a568f134a8142443398 100644 (file)
@@ -44,6 +44,7 @@
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
+#include "TextClass.h"
 #include "TextMetrics.h"
 #include "VSpace.h"
 #include "WordLangTuple.h"
@@ -63,6 +64,7 @@
 #include "insets/InsetSpecialChar.h"
 #include "insets/InsetTabular.h"
 
+#include "support/docstream.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
 #include "support/convert.h"
@@ -85,6 +87,7 @@ namespace lyx {
 using support::bformat;
 using support::contains;
 using support::split;
+using support::subst;
 
 using cap::cutSelection;
 using cap::pasteParagraphList;
@@ -307,8 +310,7 @@ void readParagraph(Buffer const & buf, Paragraph & par, Lexer & lex,
                        break;
                }
 
-               LYXERR(Debug::PARSER) << "Handling paragraph token: `"
-                                     << token << '\'' << endl;
+               LYXERR(Debug::PARSER, "Handling paragraph token: `" << token << '\'');
                if (token == "\\begin_layout" || token == "\\end_document"
                    || token == "\\end_inset" || token == "\\begin_deeper"
                    || token == "\\end_deeper") {
@@ -575,7 +577,7 @@ void Text::charInserted(Cursor & cur)
 // the cursor set functions have a special mechanism. When they
 // realize, that you left an empty paragraph, they will delete it.
 
-bool Text::cursorRightOneWord(Cursor & cur)
+bool Text::cursorForwardOneWord(Cursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
 
@@ -596,7 +598,7 @@ bool Text::cursorRightOneWord(Cursor & cur)
 }
 
 
-bool Text::cursorLeftOneWord(Cursor & cur)
+bool Text::cursorBackwardOneWord(Cursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
 
@@ -799,7 +801,7 @@ void Text::deleteWordForward(Cursor & cur)
        else {
                cur.resetAnchor();
                cur.selection() = true;
-               cursorRightOneWord(cur);
+               cursorForwardOneWord(cur);
                cur.setSelection();
                cutSelection(cur, true, false);
                checkBufferStructure(cur.buffer(), cur);
@@ -815,7 +817,7 @@ void Text::deleteWordBackward(Cursor & cur)
        else {
                cur.resetAnchor();
                cur.selection() = true;
-               cursorLeftOneWord(cur);
+               cursorBackwardOneWord(cur);
                cur.setSelection();
                cutSelection(cur, true, false);
                checkBufferStructure(cur.buffer(), cur);
@@ -836,7 +838,7 @@ void Text::changeCase(Cursor & cur, TextCase action)
        } else {
                from = cur.top();
                getWord(from, to, PARTIAL_WORD);
-               cursorRightOneWord(cur);
+               cursorForwardOneWord(cur);
        }
 
        cur.recordUndoSelection();
@@ -1052,7 +1054,7 @@ bool Text::dissolveInset(Cursor & cur) {
        ParagraphList plist;
        if (cur.lastpit() != 0 || cur.lastpos() != 0)
                plist = paragraphs();
-       cur.popLeft();
+       cur.popBackward();
        // store cursor offset
        if (spit == 0)
                spos += cur.pos();
@@ -1273,6 +1275,9 @@ docstring Text::getPossibleLabel(Cursor & cur) const
 
        docstring text;
        docstring par_text = pars_[pit].asString(cur.buffer(), false);
+       string piece;
+       // the return string of math matrices might contain linebreaks
+       par_text = subst(par_text, '\n', '-');
        for (int i = 0; i < lyxrc.label_init_length; ++i) {
                if (par_text.empty())
                        break;