From 1ef0ef4e2eda2a14b7fab43c6079b4226555be8f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 12 Dec 2003 13:57:20 +0000 Subject: [PATCH] fix math super/subscript git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8240 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/insetcommandparams.h | 6 ++---- src/lyx_main.C | 4 ---- src/lyxfunc.C | 9 --------- src/mathed/formulabase.C | 11 +---------- src/mathed/math_cursor.C | 10 ++++++++++ 5 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/insets/insetcommandparams.h b/src/insets/insetcommandparams.h index a29dc5fa95..fd6b63d820 100644 --- a/src/insets/insetcommandparams.h +++ b/src/insets/insetcommandparams.h @@ -66,11 +66,9 @@ private: /// -bool operator==(InsetCommandParams const &, - InsetCommandParams const &); +bool operator==(InsetCommandParams const &, InsetCommandParams const &); /// -bool operator!=(InsetCommandParams const &, - InsetCommandParams const &); +bool operator!=(InsetCommandParams const &, InsetCommandParams const &); #endif diff --git a/src/lyx_main.C b/src/lyx_main.C index eb5d7b0289..53f614750e 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -424,10 +424,6 @@ void LyX::defaultKeyBindings(kb_keymap * kbmap) kbmap->bind("Delete", FuncRequest(LFUN_DELETE)); kbmap->bind("BackSpace", FuncRequest(LFUN_BACKSPACE)); - // sub- and superscript -MV - kbmap->bind("~S-underscore", FuncRequest(LFUN_SUBSCRIPT)); - kbmap->bind("~S-asciicircum", FuncRequest(LFUN_SUPERSCRIPT)); - // kbmap->bindings to enable the use of the numeric keypad // e.g. Num Lock set //kbmap->bind("KP_0", FuncRequest(LFUN_SELFINSERT)); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index e82bcafdcc..015943c890 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1193,15 +1193,6 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose) setErrorMessage(N_("This is only allowed in math mode!")); break; - // passthrough hat and underscore outside mathed: - case LFUN_SUBSCRIPT: - dispatch(FuncRequest(view(), LFUN_SELFINSERT, "_")); - break; - - case LFUN_SUPERSCRIPT: - dispatch(FuncRequest(view(), LFUN_SELFINSERT, "^")); - break; - case LFUN_DIALOG_SHOW: { string const name = func.getArg(0); string data = trim(func.argument.substr(name.size())); diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index adba57c33c..21f484afef 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -604,16 +604,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd, break; } - case LFUN_SUPERSCRIPT: - case LFUN_SUBSCRIPT: - { - recordUndo(bv, Undo::ATOMIC); - mathcursor->script(cmd.action == LFUN_SUPERSCRIPT); - break; - } - - case LFUN_MATH_DELIM: - { + case LFUN_MATH_DELIM: { //lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'" << endl; string ls; string rs = split(cmd.argument, ls, ' '); diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 726fcce0b9..3f4cce319b 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1254,6 +1254,16 @@ bool MathCursor::interpret(char c) return pos() != size(); } + if (c == '_') { + script(false); + return true; + } + + if (c == '^') { + script(true); + return true; + } + if (c == '{' || c == '}' || c == '#' || c == '&' || c == '$') { niceInsert(createMathInset(string(1, c))); return true; -- 2.39.2