Buffer: commit current undo group before attempting to undo anything
This commit is contained in:
parent
9f4498e035
commit
6573f16dd9
|
@ -197,6 +197,8 @@ struct Buffer::Modification
|
||||||
|
|
||||||
bool Buffer::undo()
|
bool Buffer::undo()
|
||||||
{
|
{
|
||||||
|
commit_undo_group();
|
||||||
|
|
||||||
if (m_history_cursor == m_history.begin())
|
if (m_history_cursor == m_history.begin())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -212,6 +214,8 @@ bool Buffer::redo()
|
||||||
if (m_history_cursor == m_history.end())
|
if (m_history_cursor == m_history.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
assert(m_current_undo_group.empty());
|
||||||
|
|
||||||
for (const Modification& modification : *m_history_cursor)
|
for (const Modification& modification : *m_history_cursor)
|
||||||
apply_modification(modification);
|
apply_modification(modification);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user