From e8c88332110ef0e2ddb35b7a2621fa0902dac0fe Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 21 Nov 2014 18:56:39 +0000 Subject: [PATCH] Do not reset edition level to 0 on buffer change Keep it as is, commit undo in current buffer, and we will commit it in the new buffer when edition level gets back to 0. --- src/context.cc | 4 +--- src/context.hh | 8 +------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/context.cc b/src/context.cc index 4c72c2bf..b88400dc 100644 --- a/src/context.cc +++ b/src/context.cc @@ -177,10 +177,8 @@ void Context::change_buffer(Buffer& buffer) return; if (m_edition_level > 0) - { this->buffer().commit_undo_group(); - m_edition_level = 0; - } + m_window.reset(); if (has_client()) client().change_buffer(buffer); diff --git a/src/context.hh b/src/context.hh index cd7abb23..b7ec94e4 100644 --- a/src/context.hh +++ b/src/context.hh @@ -121,13 +121,7 @@ struct ScopedEdition : m_context(context), m_buffer(&context.buffer()) { m_context.begin_edition(); } - ~ScopedEdition() - { - // If buffer changed, the edition count - // was reset. - if (m_buffer == &m_context.buffer()) - m_context.end_edition(); - } + ~ScopedEdition() { m_context.end_edition(); } Context& context() const { return m_context; } private: