From 3afd871c2da5444223ac0cc017e296b4a9e570e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 23 Jul 2001 16:08:41 +0000 Subject: [PATCH] small bugfixes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2312 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formulabase.C | 51 +++++++++++++++++++++++----------------- src/mathed/math_cursor.C | 6 ++--- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 11a8cb3461..44a40e4335 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -623,34 +623,43 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_MATH_DELIM: { bv->lockedInsetStoreUndo(Undo::INSERT); - int ilt = '('; - int irt = '.'; static const string vdelim("(){}[]./|"); //lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n"; if (arg.empty()) break; + // try to read integers first + int ilt = '('; + int irt = '.'; istringstream is(arg.c_str()); - string lt; - string rt; - is >> lt >> rt; - //lyxerr << "formulabase::LFUN_MATH_DELIM, lt: '" << lt << "'\n"; - //lyxerr << "formulabase::LFUN_MATH_DELIM, rt: '" << rt << "'\n"; - - if (lt.size() > 1) { - latexkeys const * l = in_word_set(lt); - if (l) - ilt = l->id; - } else if (vdelim.find(lt[0]) != string::npos) - ilt = lt[0]; - - if (rt.size() > 1) { - latexkeys const * l = in_word_set(rt); - if (l) - irt = l->id; - } else if (vdelim.find(rt[0]) != string::npos) - irt = rt[0]; + is >> ilt >> irt; + + if (!is) { // ok, the beasties are no integers... try something else + ilt = '('; + irt = '.'; + + istringstream is(arg.c_str()); + string lt; + string rt; + is >> lt >> rt; + //lyxerr << "formulabase::LFUN_MATH_DELIM, lt: '" << lt << "'\n"; + //lyxerr << "formulabase::LFUN_MATH_DELIM, rt: '" << rt << "'\n"; + + if (lt.size() > 1) { + latexkeys const * l = in_word_set(lt); + if (l) + ilt = l->id; + } else if (vdelim.find(lt[0]) != string::npos) + ilt = lt[0]; + + if (rt.size() > 1) { + latexkeys const * l = in_word_set(rt); + if (l) + irt = l->id; + } else if (vdelim.find(rt[0]) != string::npos) + irt = rt[0]; + } handleDelim(bv, ilt, irt); updateLocal(bv, true); diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index f493902201..27bb3006f0 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1109,9 +1109,9 @@ MathUpDownInset * MathCursor::nearbyUpDownInset() const MathInset * p = array().prevInset(cursor().pos_); if (p && p->isUpDownInset()) return static_cast(p); - p = array().nextInset(cursor().pos_); - if (p && p->isUpDownInset()) - return static_cast(p); + //p = array().nextInset(cursor().pos_); + //if (p && p->isUpDownInset()) + // return static_cast(p); return 0; } -- 2.39.5