- } else if (nargs() > 1 && cur.idx() == 1 && cell(1).empty()) {
- // could be either subscript or super script
- recordUndoInset(cur);
- removeScript(cell_1_is_up_);
+ }
+ // Now the two suicide cases:
+ // * we have only one script which is empty
+ // * we have two scripts which are both empty.
+ // The script inset is removed completely.
+ if ((nargs() == 2 && cell(1).empty())
+ || (nargs() == 3 && cell(1).empty() && cell(2).empty())) {
+ // Make undo step. We cannot use cur for this because
+ // it does not necessarily point to us. The BufferView
+ // cursor though should do.
+ int scriptSlice
+ = cur.bv().cursor().find(this);
+ BOOST_ASSERT(scriptSlice != -1);
+ Cursor & bvCur = cur.bv().cursor();
+ bvCur.cutOff(scriptSlice);
+ bvCur.recordUndoInset();
+