]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_scriptinset.C
Fix to bug 2362: Deleting superscript also deletes subscript.
[lyx.git] / src / mathed / math_scriptinset.C
index cf23765572186e00b490bb7606b1210e4e5316e8..573072c28d07ab2a7f32cf3f542c1ea6fc980cc4 100644 (file)
@@ -245,7 +245,7 @@ void MathScriptInset::draw(PainterInfo & pi, int x, int y) const
        else {
                nuc().setXY(x + dxx(), y);
                if (editing(pi.base.bv))
-                       drawStr(pi, pi.base.font, x + dxx(), y, ".");
+                       pi.draw(x + dxx(), y, ".");
        }
        ScriptChanger dummy(pi.base);
        if (hasUp())
@@ -556,20 +556,24 @@ void MathScriptInset::notifyCursorLeaves(LCursor & cur)
 {
        MathNestInset::notifyCursorLeaves(cur);
 
-       lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl;
+       //lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl;
 
        // remove empty scripts if possible
-if (1) {
-       if (nargs() > 2 && cur.idx() == 2 && cell(2).empty()) {
-               // must be a subscript...
-               removeScript(false);
+       if (nargs() > 2) {
+               // Case of two scripts. In this case, 1 = super, 2 = sub
+               if (cur.idx() == 2 && cell(2).empty()) {
+                       // must be a subscript...
+                       removeScript(false);
+               } else if (cur.idx() == 1 && cell(1).empty()) {
+                       // must be a superscript...
+                       removeScript(true);
+               }
        } else if (nargs() > 1 && cur.idx() == 1 && cell(1).empty()) {
                // could be either subscript or super script
                removeScript(cell_1_is_up_);
        }
-}
 
-       lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl;
+       //lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl;
 }