]> git.lyx.org Git - lyx.git/commitdiff
work around for bug reported by Mario Morandini
authorAndré Pönitz <poenitz@gmx.net>
Tue, 26 Mar 2002 12:38:59 +0000 (12:38 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 26 Mar 2002 12:38:59 +0000 (12:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3838 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formulabase.C
src/mathed/math_cursor.C
src/mathed/math_cursor.h

index 19ea21e686c1017a1c618c3e58e0189040b95028..22b6bba24fae07ecbf28539dafc3fbb65f05f581 100644 (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;
index 1a2842ad69628c00e166cd5d71a6b0da24239797..e9cdf182f5bd6156a52372daef739a39a3ae2708 100644 (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");
index 4f4a19fd65ac42067bc972ea9f18ecdae0c1370a..6d8748a20377fabd78ec40a1b1473b788c280604 100644 (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