Buffer: commit current undo group before attempting to undo anything

This commit is contained in:
Maxime Coste 2013-02-20 14:23:52 +01:00
parent 9f4498e035
commit 6573f16dd9

View File

@ -197,6 +197,8 @@ struct Buffer::Modification
bool Buffer::undo()
{
commit_undo_group();
if (m_history_cursor == m_history.begin())
return false;
@ -212,6 +214,8 @@ bool Buffer::redo()
if (m_history_cursor == m_history.end())
return false;
assert(m_current_undo_group.empty());
for (const Modification& modification : *m_history_cursor)
apply_modification(modification);