small bugfixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2312 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-07-23 16:08:41 +00:00
parent 0901dfd71f
commit 3afd871c2d
2 changed files with 31 additions and 22 deletions

View File

@ -623,34 +623,43 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
case LFUN_MATH_DELIM: case LFUN_MATH_DELIM:
{ {
bv->lockedInsetStoreUndo(Undo::INSERT); bv->lockedInsetStoreUndo(Undo::INSERT);
int ilt = '(';
int irt = '.';
static const string vdelim("(){}[]./|"); static const string vdelim("(){}[]./|");
//lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n"; //lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
if (arg.empty()) if (arg.empty())
break; break;
// try to read integers first
int ilt = '(';
int irt = '.';
istringstream is(arg.c_str()); istringstream is(arg.c_str());
string lt; is >> ilt >> irt;
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) { if (!is) { // ok, the beasties are no integers... try something else
latexkeys const * l = in_word_set(lt); ilt = '(';
if (l) irt = '.';
ilt = l->id;
} else if (vdelim.find(lt[0]) != string::npos)
ilt = lt[0];
if (rt.size() > 1) { istringstream is(arg.c_str());
latexkeys const * l = in_word_set(rt); string lt;
if (l) string rt;
irt = l->id; is >> lt >> rt;
} else if (vdelim.find(rt[0]) != string::npos) //lyxerr << "formulabase::LFUN_MATH_DELIM, lt: '" << lt << "'\n";
irt = rt[0]; //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); handleDelim(bv, ilt, irt);
updateLocal(bv, true); updateLocal(bv, true);

View File

@ -1109,9 +1109,9 @@ MathUpDownInset * MathCursor::nearbyUpDownInset() const
MathInset * p = array().prevInset(cursor().pos_); MathInset * p = array().prevInset(cursor().pos_);
if (p && p->isUpDownInset()) if (p && p->isUpDownInset())
return static_cast<MathUpDownInset *>(p); return static_cast<MathUpDownInset *>(p);
p = array().nextInset(cursor().pos_); //p = array().nextInset(cursor().pos_);
if (p && p->isUpDownInset()) //if (p && p->isUpDownInset())
return static_cast<MathUpDownInset *>(p); // return static_cast<MathUpDownInset *>(p);
return 0; return 0;
} }