]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Harmonize naming
[lyx.git] / src / Text.cpp
index e04cc6919388bc3f04e0deca2c9e33c23a3e1a17..8e8d64132d192039d03510edc407a9d0f28b9ae5 100644 (file)
@@ -582,7 +582,7 @@ class TextCompletionList : public CompletionList
 public:
        ///
        TextCompletionList(Cursor const & cur, WordList const * list)
-               : buffer_(cur.buffer()), pos_(0), list_(list)
+               : buffer_(cur.buffer()), list_(list)
        {}
        ///
        virtual ~TextCompletionList() {}
@@ -604,8 +604,6 @@ private:
        ///
        Buffer const * buffer_;
        ///
-       size_t pos_;
-       ///
        WordList const * list_;
 };
 
@@ -726,7 +724,7 @@ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos,
 
 void Text::breakParagraph(Cursor & cur, bool inverse_logic)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        Paragraph & cpar = cur.paragraph();
        pit_type cpit = cur.pit();
@@ -737,8 +735,11 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic)
        if (cur.lastpos() == 0 && !cpar.allowEmpty()) {
                if (changeDepthAllowed(cur, DEC_DEPTH))
                        changeDepth(cur, DEC_DEPTH);
-               else 
-                       setLayout(cur, tclass.defaultLayoutName());
+               else {
+                       docstring const & lay = cur.paragraph().usePlainLayout()
+                           ? tclass.plainLayoutName() : tclass.defaultLayoutName();
+                       setLayout(cur, lay);
+               }
                return;
        }
 
@@ -883,7 +884,7 @@ void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str,
 // same Paragraph one to the right and make a rebreak
 void Text::insertChar(Cursor & cur, char_type c)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        cur.recordUndo(INSERT_UNDO);
 
@@ -1033,7 +1034,7 @@ void Text::charInserted(Cursor & cur)
            && !par.isWordSeparator(cur.pos() - 2)
            && par.isWordSeparator(cur.pos() - 1)) {
                // get the word in front of cursor
-               LBUFERR(this == cur.text(), _("Invalid cursor."));
+               LBUFERR(this == cur.text());
                cur.paragraph().updateWords();
        }
 }
@@ -1044,7 +1045,7 @@ void Text::charInserted(Cursor & cur)
 
 bool Text::cursorForwardOneWord(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        pos_type const lastpos = cur.lastpos();
        pit_type pit = cur.pit();
@@ -1059,7 +1060,7 @@ bool Text::cursorForwardOneWord(Cursor & cur)
                        return false;
        }
 
-       if (lyxrc.mac_like_word_movement) {
+       if (lyxrc.mac_like_cursor_movement) {
                // Skip through trailing punctuation and spaces.
                while (pos != lastpos && (par.isChar(pos) || par.isSpace(pos)))
                         ++pos;
@@ -1091,7 +1092,7 @@ bool Text::cursorForwardOneWord(Cursor & cur)
 
 bool Text::cursorBackwardOneWord(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        pit_type pit = cur.pit();
        pos_type pos = cur.pos();
@@ -1101,7 +1102,7 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
        if (pos == 0 && pit != 0)
                return setCursor(cur, pit - 1, getPar(pit - 1).size());
 
-       if (lyxrc.mac_like_word_movement) {
+       if (lyxrc.mac_like_cursor_movement) {
                // Skip through punctuation and spaces.
                while (pos != 0 && (par.isChar(pos - 1) || par.isSpace(pos - 1)))
                        --pos;
@@ -1132,7 +1133,7 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
 
 bool Text::cursorVisLeftOneWord(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        pos_type left_pos, right_pos;
        bool left_is_letter, right_is_letter;
@@ -1169,7 +1170,7 @@ bool Text::cursorVisLeftOneWord(Cursor & cur)
 
 bool Text::cursorVisRightOneWord(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        pos_type left_pos, right_pos;
        bool left_is_letter, right_is_letter;
@@ -1208,7 +1209,7 @@ bool Text::cursorVisRightOneWord(Cursor & cur)
 
 void Text::selectWord(Cursor & cur, word_location loc)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        CursorSlice from = cur.top();
        CursorSlice to = cur.top();
        getWord(from, to, loc);
@@ -1226,7 +1227,7 @@ void Text::selectWord(Cursor & cur, word_location loc)
 
 void Text::selectAll(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        if (cur.lastpos() == 0 && cur.lastpit() == 0)
                return;
        // If the cursor is at the beginning, make sure the cursor ends there
@@ -1247,7 +1248,7 @@ void Text::selectAll(Cursor & cur)
 // selection is currently set
 bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        if (cur.selection())
                return false;
        selectWord(cur, loc);
@@ -1257,7 +1258,7 @@ bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)
 
 void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        if (!cur.selection()) {
                bool const changed = cur.paragraph().isChanged(cur.pos());
@@ -1412,7 +1413,7 @@ void Text::rejectChanges()
 
 void Text::deleteWordForward(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        if (cur.lastpos() == 0)
                cursorForward(cur);
        else {
@@ -1428,7 +1429,7 @@ void Text::deleteWordForward(Cursor & cur)
 
 void Text::deleteWordBackward(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        if (cur.lastpos() == 0)
                cursorBackward(cur);
        else {
@@ -1445,7 +1446,7 @@ void Text::deleteWordBackward(Cursor & cur)
 // Kill to end of line.
 void Text::changeCase(Cursor & cur, TextCase action)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        CursorSlice from;
        CursorSlice to;
 
@@ -1574,7 +1575,7 @@ bool Text::erase(Cursor & cur)
 
 bool Text::backspacePos0(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        if (cur.pit() == 0)
                return false;
 
@@ -1627,7 +1628,7 @@ bool Text::backspacePos0(Cursor & cur)
 
 bool Text::backspace(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        bool needsUpdate = false;
        if (cur.pos() == 0) {
                if (cur.pit() == 0)
@@ -1829,7 +1830,7 @@ bool Text::read(Lexer & lex,
 // Returns the current font and depth as a message.
 docstring Text::currentState(Cursor const & cur) const
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
        Buffer & buf = *cur.buffer();
        Paragraph const & par = cur.paragraph();
        odocstringstream os;
@@ -2015,7 +2016,7 @@ void Text::forToc(docstring & os, size_t maxlen, bool shorten) const
 
 void Text::charsTranspose(Cursor & cur)
 {
-       LBUFERR(this == cur.text(), _("Invalid cursor."));
+       LBUFERR(this == cur.text());
 
        pos_type pos = cur.pos();
 
@@ -2115,7 +2116,7 @@ CompletionList const * Text::createCompletionList(Cursor const & cur) const
 
 bool Text::insertCompletion(Cursor & cur, docstring const & s, bool /*finished*/)
 {      
-       LBUFERR(cur.bv().cursor() == cur, _("Invalid cursor."));
+       LBUFERR(cur.bv().cursor() == cur);
        cur.insert(s);
        cur.bv().cursor() = cur;
        if (!(cur.result().screenUpdate() & Update::Force))