]> git.lyx.org Git - lyx.git/commitdiff
InsetMathHull: LFUN_INSET_INSERT: Fix label insertion
authorAbdelrazak Younes <younes@lyx.org>
Tue, 4 Mar 2008 12:43:20 +0000 (12:43 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 4 Mar 2008 12:43:20 +0000 (12:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23437 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathHull.cpp

index c5ecd92a2c31810348089ee587aa3bcdbd84dd73..cd2d5c42cc16391418a3749bc43abd50335566b1 100644 (file)
@@ -1176,6 +1176,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_INSET_INSERT: {
                //lyxerr << "arg: " << to_utf8(cmd.argument()) << endl;
 
        case LFUN_INSET_INSERT: {
                //lyxerr << "arg: " << to_utf8(cmd.argument()) << endl;
+               // FIXME: this should be cleaned up to use InsetLabel methods directly.
                string const name = cmd.getArg(0);
                if (name == "label") {
                        InsetCommandParams p(LABEL_CODE);
                string const name = cmd.getArg(0);
                if (name == "label") {
                        InsetCommandParams p(LABEL_CODE);
@@ -1188,9 +1189,14 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
                                numbered(r, true);
                        docstring old = label(r);
                        if (str != old) {
                                numbered(r, true);
                        docstring old = label(r);
                        if (str != old) {
-                               cur.bv().buffer().changeRefsIfUnique(old, str,
-                                                       REF_CODE);
-                               label(r, str);
+                               if (label_[r])
+                                       // The label will take care of the reference update.
+                                       label(r, str);
+                               else {
+                                       label(r, str);
+                                       // Newly created inset so initialize it.
+                                       label_[r]->initView();
+                               }
                        }
                        break;
                }
                        }
                        break;
                }