]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
Fix bug #8083: Fix the selection of cells below multirows
[lyx.git] / src / insets / InsetBibitem.cpp
index 5da47510386c94c929f67a3a7ebc9bfb8af314ee..3aaaceacbdd8d954fb53fcd1b692b4f3f75e8dd9 100644 (file)
@@ -25,7 +25,7 @@
 #include "FuncRequest.h"
 #include "InsetIterator.h"
 #include "InsetList.h"
-#include "Language.h" 
+#include "Language.h"
 #include "Lexer.h"
 #include "output_xhtml.h"
 #include "OutputParams.h"
@@ -122,6 +122,9 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
                        cur.noScreenUpdate();
                        break;
                }
+
+               cur.recordUndo();
+
                docstring const & old_key = params()["key"];
                docstring const & old_label = params()["label"];
                docstring label = p["label"];
@@ -163,12 +166,12 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
                                                if (label[previous] != '{')
                                                        label.replace(pos, 1, lbrace + brackets_escape[k] + rbrace);
                                }
+               }
 
-                       if (old_label != label) {
-                               p["label"] = label;
-                               cur.forceBufferUpdate();
-                               buffer().invalidateBibinfoCache();
-                       }
+               if (old_label != label) {
+                       p["label"] = label;
+                       cur.forceBufferUpdate();
+                       buffer().invalidateBibinfoCache();
                }
 
                setParam("label", p["label"]);
@@ -308,15 +311,18 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
 }
 
 
-void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it) const
+void InsetBibitem::collectBibKeys(InsetIterator const & it) const
 {
        docstring const key = getParam("key");
+       docstring const label = getParam("label");
        BibTeXInfo keyvalmap(false);
-       keyvalmap.label(bibLabel());
-       DocIterator doc_it(it); 
+       keyvalmap.key(key);
+       keyvalmap.label(label);
+       DocIterator doc_it(it);
        doc_it.forwardPos();
-       keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
-       keys[key] = keyvalmap;
+       keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(
+               AS_STR_INSETS | AS_STR_SKIPDELETE);
+       buffer().addBibTeXInfo(key, keyvalmap);
 }
 
 
@@ -334,14 +340,6 @@ void InsetBibitem::updateBuffer(ParIterator const & it, UpdateType utype)
        } else {
                autolabel_ = from_ascii("??");
        }
-       if (!buffer().isBibInfoCacheValid()) {
-               BiblioInfo bi = buffer().masterBibInfo();
-               docstring const key = getParam("key");
-               BibTeXInfo keyvalmap(false);
-               keyvalmap.label(bibLabel());
-               keyvalmap[from_ascii("ref")] = it.paragraph().asString();
-               bi[key] = keyvalmap;
-       }
 }