fix math super/subscript

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8240 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-12-12 13:57:20 +00:00
parent cd78cc2355
commit 1ef0ef4e2e
5 changed files with 13 additions and 27 deletions

View File

@ -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

View File

@ -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));

View File

@ -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()));

View File

@ -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, ' ');

View File

@ -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;