Fixup 9c92494e1a: avoid crash in Inset::dissolve()

The code path when the inset is empty did not fixup the cursor
position correctly.

Part of bug #10667.
This commit is contained in:
Jean-Marc Lasgouttes 2017-06-23 19:44:54 +02:00
parent 87ccd23047
commit 8910a8a1cc

View File

@ -1783,20 +1783,20 @@ bool Text::dissolveInset(Cursor & cur)
pasteParagraphList(cur, plist, b.params().documentClassPtr(),
b.errorList("Paste"));
// restore position
cur.pit() = min(cur.lastpit(), spit);
cur.pos() = min(cur.lastpos(), spos);
}
// delete the inset now
inset_it.paragraph().eraseChar(inset_it.pos(), b.params().track_changes);
cur.forceBufferUpdate();
// restore position
cur.pit() = min(cur.lastpit(), spit);
cur.pos() = min(cur.lastpos(), spos);
// Ensure the current language is set correctly (bug 6292)
cur.text()->setCursor(cur, cur.pit(), cur.pos());
cur.clearSelection();
cur.resetAnchor();
cur.forceBufferUpdate();
return true;
}