From 468bd63569adeb6fd2abec067ca338539bb717f4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 13 May 2017 11:18:21 +0100 Subject: [PATCH] Tweak buffer change code so that WinDisplay hooks can use info boxes --- src/client.cc | 2 +- src/context.cc | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/client.cc b/src/client.cc index d41a1ba9..7389b224 100644 --- a/src/client.cc +++ b/src/client.cc @@ -179,9 +179,9 @@ void Client::change_buffer(Buffer& buffer) context().selections_write_only() = std::move(ws.selections); context().set_window(*m_window); m_window->set_dimensions(m_ui->dimensions()); - force_redraw(); m_window->hooks().run_hook("WinDisplay", buffer.name(), context()); + force_redraw(); } static bool is_inline(InfoStyle style) diff --git a/src/context.cc b/src/context.cc index 8d225052..09d1d4d5 100644 --- a/src/context.cc +++ b/src/context.cc @@ -148,18 +148,19 @@ void Context::change_buffer(Buffer& buffer) if (m_edition_level > 0) this->buffer().commit_undo_group(); - m_window.reset(); - if (has_client()) - { - client().change_buffer(buffer); - client().info_hide(); - client().menu_hide(); - } - else - m_selections = SelectionList{buffer, Selection{}}; if (has_input_handler()) input_handler().reset_normal_mode(); + + m_window.reset(); + if (has_client()) + { + client().info_hide(); + client().menu_hide(); + client().change_buffer(buffer); + } + else + m_selections = SelectionList{buffer, Selection{}}; } SelectionList& Context::selections()