]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
LFUN_UNICODE_INSERT - unicode-insert
[lyx.git] / src / text.C
index e0bd609b05e2561aa793266d2e442826475cf750..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();
@@ -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();
 }
@@ -2358,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())
@@ -2448,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;
                        }
                }