From 6573f16dd9ac32242129f66e87a6a8e4b76eab0e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 20 Feb 2013 14:23:52 +0100 Subject: [PATCH] Buffer: commit current undo group before attempting to undo anything --- src/buffer.cc | 4 ++++ 1 file changed, 4 insertions(+) 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);