]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
Extend the notermination flag to math as well.
[lyx.git] / src / insets / InsetBibitem.cpp
index 1dedfafe8598bd549534830e9a2f564d98352ab6..ac3c9149679b9073db7146afa1dfd2416e732c71 100644 (file)
@@ -166,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"]);
@@ -294,7 +294,7 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
                docstring latex_lbl;
                for (size_t n = 0; n < lbl.size(); ++n) {
                        try {
-                               latex_lbl += runparams.encoding->latexChar(lbl[n]);
+                               latex_lbl += runparams.encoding->latexChar(lbl[n]).first;
                        } catch (EncodingException & /* e */) {
                                if (runparams.dryrun) {
                                        latex_lbl += "<" + _("LyX Warning: ")
@@ -314,11 +314,14 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
 void InsetBibitem::collectBibKeys(InsetIterator const & it) const
 {
        docstring const key = getParam("key");
+       docstring const label = getParam("label");
        BibTeXInfo keyvalmap(false);
-       keyvalmap.label(bibLabel());
+       keyvalmap.key(key);
+       keyvalmap.label(label);
        DocIterator doc_it(it);
        doc_it.forwardPos();
-       keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
+       keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(
+               AS_STR_INSETS | AS_STR_SKIPDELETE);
        buffer().addBibTeXInfo(key, keyvalmap);
 }