work around for bug reported by Mario Morandini

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3838 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-03-26 12:38:59 +00:00
parent 07386186b0
commit 28168bd4df
3 changed files with 14 additions and 3 deletions

View File

@ -667,11 +667,12 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
MathInset::idx_type idx = 0;
MathGridInset * p = mathcursor ? mathcursor->enclosingGrid(idx) : 0;
if (p) {
mathcursor->popToEnclosingGrid();
bv->lockedInsetStoreUndo(Undo::EDIT);
char al = arg.size() ? arg[0] : 'c';
char align = arg.size() ? arg[0] : 'c';
switch (action) {
case LFUN_MATH_HALIGN: p->halign(al, p->col(idx)); break;
case LFUN_MATH_VALIGN: p->valign(al); break;
case LFUN_MATH_HALIGN: p->halign(align, p->col(idx)); break;
case LFUN_MATH_VALIGN: p->valign(align); break;
case LFUN_MATH_ROW_INSERT: p->addRow(p->row(idx)); break;
case LFUN_MATH_ROW_DELETE: p->delRow(p->row(idx)); break;
case LFUN_MATH_COLUMN_INSERT: p->addCol(p->col(idx)); break;

View File

@ -897,12 +897,20 @@ MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const
if (p) {
idx = Cursor_[i].idx_;
return p;
lyxerr << "found grid and idx: " << idx << "\n";
}
}
return 0;
}
void MathCursor::popToEnclosingGrid()
{
while (Cursor_.size() && !Cursor_.back().par_->asGridInset())
Cursor_.pop_back();
}
void MathCursor::pullArg(bool goright)
{
dump("pullarg");

View File

@ -106,6 +106,8 @@ public:
MathInset * par() const;
/// return the next enclosing grid inset and the cursor's index in it
MathGridInset * enclosingGrid(idx_type &) const;
/// return the next enclosing grid inset and the cursor's index in it
void popToEnclosingGrid();
///
InsetFormulaBase * formula();
/// current offset in the current cell