]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
LFUN_UNICODE_INSERT - unicode-insert
[lyx.git] / src / text.C
index b6d69c991b27939d7f9549c40a4644036dd1ad8b..88033fde0ccd0e1be22119e3944843ff2b2e261b 100644 (file)
@@ -331,7 +331,6 @@ void readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
                        errorList.push_back(ErrorItem(_("Change tracking error"),
                                            bformat(_("Unknown author index for insertion: %1$d\n"), aid),
                                            par.id(), 0, par.size()));
-
                        change = Change(Change::UNCHANGED);
                } else
                        change = Change(Change::INSERTED, bp.author_map[aid], ct);
@@ -345,7 +344,6 @@ void readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
                        errorList.push_back(ErrorItem(_("Change tracking error"),
                                            bformat(_("Unknown author index for deletion: %1$d\n"), aid),
                                            par.id(), 0, par.size()));
-
                        change = Change(Change::UNCHANGED);
                } else
                        change = Change(Change::DELETED, bp.author_map[aid], ct);
@@ -368,7 +366,6 @@ void readParagraph(Buffer const & buf, Paragraph & par, LyXLex & lex,
        Change change(Change::UNCHANGED);
 
        while (lex.isOK()) {
-
                readParToken(buf, par, lex, token, font, change, errorList);
 
                lex.nextToken();
@@ -1101,7 +1098,7 @@ void LyXText::breakParagraph(LCursor & cur, bool keep_layout)
        // It is better to erase the space (Dekel)
        if (cur.pos() != cur.lastpos() && cpar.isLineSeparator(cur.pos()))
                // FIXME: change tracking (MG)
-               cpar.erase(cur.pos(), cur.buffer().params().trackChanges);
+               cpar.eraseChar(cur.pos(), cur.buffer().params().trackChanges);
 
        // How should the layout for the new paragraph be?
        int preserve_layout = 0;
@@ -1137,7 +1134,7 @@ void LyXText::breakParagraph(LCursor & cur, bool keep_layout)
 
        while (!pars_[next_par].empty() && pars_[next_par].isNewline(0))
                // FIXME: change tracking (MG)
-               pars_[next_par].erase(0, cur.buffer().params().trackChanges);
+               pars_[next_par].eraseChar(0, cur.buffer().params().trackChanges);
 
        ParIterator current_it(cur);
        ParIterator last_it(cur);
@@ -1246,8 +1243,7 @@ void LyXText::insertChar(LCursor & cur, char_type c)
                }
        }
 
-       // FIXME: change tracking (MG)
-       par.insertChar(cur.pos(), c, current_font, Change(Change::INSERTED));
+       par.insertChar(cur.pos(), c, current_font, cur.buffer().params().trackChanges);
        setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
        charInserted();
 }
@@ -1624,10 +1620,11 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action)
                                break;
                        }
                }
-#ifdef WITH_WARNINGS
-#warning changes
-#endif
-               pars_[pit].setChar(pos, c);
+
+               // FIXME: change tracking (MG)
+               // sorry but we are no longer allowed to set a single character directly
+               // we have to rewrite this method in terms of erase&insert operations
+               //pars_[pit].setChar(pos, c);
                ++pos;
        }
 }
@@ -1786,7 +1783,7 @@ bool LyXText::backspace(LCursor & cur)
                setCursorIntern(cur, cur.pit(), cur.pos() - 1,
                                false, cur.boundary());
                // FIXME: change tracking (MG)
-               cur.paragraph().erase(cur.pos(), cur.buffer().params().trackChanges);
+               cur.paragraph().eraseChar(cur.pos(), cur.buffer().params().trackChanges);
        }
 
        if (cur.pos() == cur.lastpos())
@@ -1819,7 +1816,7 @@ bool LyXText::dissolveInset(LCursor & cur) {
        spit += cur.pit();
        Buffer & b = cur.buffer();
        // FIXME: change tracking (MG)
-       cur.paragraph().erase(cur.pos(), b.params().trackChanges);
+       cur.paragraph().eraseChar(cur.pos(), b.params().trackChanges);
        if (!plist.empty()) {
                pasteParagraphList(cur, plist, b.params().textclass,
                                   b.errorList("Paste"));
@@ -2357,14 +2354,12 @@ string LyXText::currentState(LCursor & cur)
        Paragraph const & par = cur.paragraph();
        std::ostringstream os;
 
-       // FIXME: change tracking (MG)
-       bool const show_change = par.lookupChange(cur.pos()) != Change(Change::UNCHANGED);
-
        if (buf.params().trackChanges)
                os << "[C] ";
 
-       if (show_change) {
-               Change change = par.lookupChange(cur.pos());
+       Change change = par.lookupChange(cur.pos());
+
+       if (change.type != Change::UNCHANGED) {
                Author const & a = buf.params().authors().get(change.author);
                os << to_utf8(_("Change: ")) << a.name();
                if (!a.email().empty())
@@ -2447,13 +2442,11 @@ string LyXText::getPossibleLabel(LCursor & cur) const
        // for captions, we want the abbreviation of the float type
        if (layout->labeltype == LABEL_SENSITIVE) {
                // Search for the first float or wrap inset in the iterator
-               size_t i = cur.depth();
-               while (i > 0) {
-                       --i;
+               for (int i = cur.depth(); --i >= 0; ) {
                        InsetBase * const in = &cur[i].inset();
                        if (in->lyxCode() == InsetBase::FLOAT_CODE
                            || in->lyxCode() == InsetBase::WRAP_CODE) {
-                               name = in->getInsetName();
+                               name = to_utf8(in->getInsetName());
                                break;
                        }
                }