]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNote.cpp
Fix bug #6315: counters in insets that don't produce output have ghost values.
[lyx.git] / src / insets / InsetNote.cpp
index fac99bc8161408444ea83223bd3b9ecb5f77436a..d3c1b1e2b49938e7bf4fc4dab8d526502e1e07a2 100644 (file)
@@ -171,11 +171,15 @@ bool InsetNote::showInsetDialog(BufferView * bv) const
 
 void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
-       switch (cmd.action_) {
+       switch (cmd.action()) {
 
        case LFUN_INSET_MODIFY:
+               cur.recordUndoInset(ATOMIC_UNDO, this);
                string2params(to_utf8(cmd.argument()), params_);
                setButtonLabel();
+               // what we really want here is a TOC update, but that means
+               // a full buffer update
+               cur.forceBufferUpdate();
                break;
 
        case LFUN_INSET_DIALOG_UPDATE:
@@ -192,7 +196,7 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
 bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
-       switch (cmd.action_) {
+       switch (cmd.action()) {
 
        case LFUN_INSET_MODIFY:
                // disallow comment and greyed out in commands
@@ -223,8 +227,8 @@ void InsetNote::addToToc(DocIterator const & cpit)
        Toc & toc = buffer().tocBackend().toc("note");
        docstring str;
        str = notetranslator_loc().find(params_.type) + from_ascii(": ")
-               + getNewLabel(str);
-       toc.push_back(TocItem(pit, 0, str));
+               + text().getPar(0).asString();
+       toc.push_back(TocItem(pit, 0, str, toolTipText()));
        // Proceed with the rest of the inset.
        InsetCollapsable::addToToc(cpit);
 }