Do not allow changing buffer when the context is editing
This commit is contained in:
parent
aadbd390c7
commit
9455303a1e
|
@ -159,6 +159,8 @@ void Context::forget_jumps_to_buffer(Buffer& buffer)
|
|||
|
||||
void Context::change_buffer(Buffer& buffer)
|
||||
{
|
||||
if (m_edition_level > 0)
|
||||
throw runtime_error("the current buffer is still being edited");
|
||||
m_window.reset();
|
||||
if (has_client())
|
||||
client().change_buffer(buffer);
|
||||
|
@ -192,12 +194,16 @@ std::vector<String> Context::selections_content() const
|
|||
|
||||
void Context::begin_edition()
|
||||
{
|
||||
++m_edition_level;
|
||||
if (m_edition_level >= 0)
|
||||
++m_edition_level;
|
||||
}
|
||||
|
||||
void Context::end_edition()
|
||||
{
|
||||
kak_assert(m_edition_level > 0);
|
||||
if (m_edition_level < 0)
|
||||
return;
|
||||
|
||||
kak_assert(m_edition_level != 0);
|
||||
if (m_edition_level == 1)
|
||||
buffer().commit_undo_group();
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
void set_name(String name) { m_name = std::move(name); }
|
||||
|
||||
bool is_editing() const { return m_edition_level!= 0; }
|
||||
void disable_undo_handling() { ++m_edition_level; }
|
||||
void disable_undo_handling() { m_edition_level = -1; }
|
||||
private:
|
||||
void begin_edition();
|
||||
void end_edition();
|
||||
|
|
Loading…
Reference in New Issue
Block a user