summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-02-20 14:23:52 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-02-20 14:23:52 +0100
commit6573f16dd9ac32242129f66e87a6a8e4b76eab0e (patch)
tree5f0eb2eaf6c5c042132668183d32cb06a2df6ba2 /src/buffer.cc
parent9f4498e0354a77db0ed89dcae30169f97543d271 (diff)
Buffer: commit current undo group before attempting to undo anything
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index 3eb6920c..2bf5db95 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -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);