]> git.lyx.org Git - lyx.git/commitdiff
fix x^1<space>_
authorAndré Pönitz <poenitz@gmx.net>
Fri, 12 Oct 2001 15:38:58 +0000 (15:38 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 12 Oct 2001 15:38:58 +0000 (15:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2876 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 38dda883f567c7c6d605a367f9413192947b800c..f233c7851dbf1dc4b91414ff19ce48e7a41ad167 100644 (file)
@@ -16,6 +16,7 @@
 #include <fstream>
 
 #include "Lsstream.h"
+#include "support/LAssert.h"
 
 #ifdef __GNUG__
 #pragma implementation
@@ -641,10 +642,11 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                result = UNDISPATCHED;
        }
 
+       lyx::Assert(mathcursor);
        //mathcursor->normalize();
 
-       if (was_macro != mathcursor->inMacroMode()
-                               && action >= 0 && action != LFUN_BACKSPACE) 
+       if (//was_macro != mathcursor->inMacroMode() &&
+                               action >= 0 && action != LFUN_BACKSPACE) 
                updateLocal(bv, true);
        
        if (mathcursor->selection() || was_selection)
index 4c8ec8081d716661d9f072d298743f5092c3315f..ee057dedc291ef1887bc89bd36a956b1f7002ad2 100644 (file)
@@ -132,9 +132,10 @@ MathCursor::MathCursor(InsetFormulaBase * formula, bool left)
 
 void MathCursor::push(MathAtom & t)
 {
-       //cerr << "Entering atom "; t->write(cerr, false); cerr << " left\n";
        MathCursorPos p;
        p.par_ = &t;
+       p.idx_ = 0;
+       p.pos_ = 0;
        Cursor_.push_back(p);
 }
 
@@ -937,7 +938,10 @@ void MathCursor::normalize() const
 
        if (pos() > size()) {
                lyxerr << "this should not really happen - 2: "
-                      << pos() << " " << size() << "\n";
+                       << pos() << " " << size() <<  " in idx: " << it->idx()
+                       << " in atom: '";
+               it->par()->write(lyxerr, false);
+               lyxerr << "\n";
                dump("error 4");
        }
        it->pos() = min(pos(), size());
@@ -1321,17 +1325,22 @@ void MathCursor::interpret(char c)
                if (hasPrevAtom() && prevAtom()->asScriptInset()) {
                        prevAtom()->asScriptInset()->ensure(up);
                        pushRight(prevAtom());
+                       idx() = up;
                        pos() = size();
                } else if (hasNextAtom() && nextAtom()->asScriptInset()) {
                        nextAtom()->asScriptInset()->ensure(up);
                        pushLeft(nextAtom());
+                       idx() = up;
                        pos() = 0;
                } else {
                        plainInsert(MathAtom(new MathScriptInset(up)));
+                       prevAtom()->asScriptInset()->ensure(up);
                        pushRight(prevAtom());
+                       idx() = up;
+                       pos() = 0;
                }
-               idx() = up;
                selPaste();
+               dump("1");
                return;
        }
 
@@ -1393,7 +1402,6 @@ void MathCursor::interpret(char c)
                else
                        insert(c, LM_TC_VAR);
 
-#warning greek insert problem? look here!
                if (lastcode_ == LM_TC_GREEK1)
                        lastcode_ = LM_TC_VAR;
                return; 
index 305d22c86ad517fb9f2702a5be4e72934fe8269d..a0ce5ebbc59c65d36bc701a5c9f6cf92b8bf624b 100644 (file)
@@ -294,3 +294,19 @@ bool MathScriptInset::hasDown() const
 {
        return script_[0];
 }
+
+
+bool MathScriptInset::idxRight(MathInset::idx_type &,
+                                MathInset::pos_type &) const
+{
+       return false;
+}
+
+
+bool MathScriptInset::idxLeft(MathInset::idx_type &,
+                               MathInset::pos_type &) const
+{
+       return false;
+}
+
+
index d4c5e62f40b72a70f87e0adf7abbe7f114ba5aef..59e0535a68472b67926d57ef98e5c4e99e1199eb 100644 (file)
@@ -40,6 +40,11 @@ public:
        ///
        int width(MathInset const * nucleus) const;
 
+       ///
+       bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
+       ///
+       bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
+
        ///
        MathScriptInset const * asScriptInset() const;
        ///