]> git.lyx.org Git - features.git/commitdiff
only accept #n in macros with at least n arguments
authorAndré Pönitz <poenitz@gmx.net>
Wed, 13 Mar 2002 11:20:35 +0000 (11:20 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 13 Mar 2002 11:20:35 +0000 (11:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3738 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C

index c3ee8d0996e124c1b3c95b83a645ae192544f258..98e772ccb479af2ccfea8375f3ec76d76f0e9df9 100644 (file)
@@ -38,6 +38,7 @@
 #include "math_hullinset.h"
 #include "math_iterator.h"
 #include "math_macroarg.h"
+#include "math_macrotemplate.h"
 #include "math_mathmlstream.h"
 #include "math_parser.h"
 #include "math_replace.h"
@@ -1371,7 +1372,9 @@ bool MathCursor::interpret(char c)
        if (inMacroArgMode()) {
                --pos();
                plainErase();
-               if ('1' <= c && c <= '9')
+               int n = c - '0';
+               MathMacroTemplate * p = formula()->par()->asMacroTemplate();
+               if (p && 1 <= n && n <= p->numargs())
                        insert(MathAtom(new MathMacroArgument(c - '0')));
                else {
                        insert(MathAtom(new MathSpecialCharInset('#')));