]> git.lyx.org Git - lyx.git/commitdiff
* enter new macro template and select the name. This save a lot of keystrokes to...
authorStefan Schimanski <sts@lyx.org>
Sat, 6 Sep 2008 15:10:23 +0000 (15:10 +0000)
committerStefan Schimanski <sts@lyx.org>
Sat, 6 Sep 2008 15:10:23 +0000 (15:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26315 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text3.cpp

index 729ce59b62407c4c9fd99d745d71160fa62160c8..009077c342ab9f9ed944e627df17c0483131dfac 100644 (file)
@@ -1481,8 +1481,16 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        MacroType type = MacroTypeNewcommand;
                        if (s2 == "def")
                                type = MacroTypeDef;
-                       cur.insert(new MathMacroTemplate(from_utf8(token(s, ' ', 0)), nargs, false, type));
-                       //cur.nextInset()->edit(cur, true);
+                       MathMacroTemplate * inset = new MathMacroTemplate(from_utf8(token(s, ' ', 0)), nargs, false, type);
+                       inset->setBuffer(bv->buffer());
+                       insertInset(cur, inset);
+
+                       // enter macro inset and select the name
+                       cur.push(*inset);
+                       cur.top().pos() = cur.top().lastpos();
+                       cur.resetAnchor();
+                       cur.selection() = true;
+                       cur.top().pos() = 0;
                }
                break;