+ if (displayMode_ == DISPLAY_UNFOLDED) {
+ docstring const & unfolded_name = name();
+ if (unfolded_name != name_) {
+ // The macro name was changed
+ Cursor inset_cursor = old;
+ int macroSlice = inset_cursor.find(this);
+ // returning true means the cursor is "now" invalid,
+ // which it was.
+ LASSERT(macroSlice != -1, return true);
+ inset_cursor.cutOff(macroSlice);
+ inset_cursor.recordUndoInset();
+ inset_cursor.pop();
+ inset_cursor.cell().erase(inset_cursor.pos());
+ inset_cursor.cell().insert(inset_cursor.pos(),
+ createInsetMath(unfolded_name, cur.buffer()));
+ cur.resetAnchor();
+ cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
+ return true;
+ }
+ }
+ cur.screenUpdateFlags(Update::Force);