From 2ebd47ea30b1280a97d5ad4c3b37c1edb4c9e55d Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Sat, 11 Mar 2006 16:34:52 +0000 Subject: [PATCH] Fix to bug 2362: Deleting superscript also deletes subscript. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13342 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 5 +++++ src/mathed/math_scriptinset.C | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 188687bebd..042e312e9b 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,8 @@ +2006-03-11 Martin Vermeer + + * math_scriptinset.C (notifyCursorLeaves): Fix to bug 2362: Deleting + superscript also deletes subscript + 2006-02-28 Martin Vermeer * math_nestinset.C (doDispatch): fix (properly) insertion of diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index fc6f7601f1..573072c28d 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -559,15 +559,19 @@ void MathScriptInset::notifyCursorLeaves(LCursor & cur) //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; }