Tweak buffer change code so that WinDisplay hooks can use info boxes

This commit is contained in:
Maxime Coste 2017-05-13 11:18:21 +01:00
parent 3a0d9481ac
commit 468bd63569
2 changed files with 11 additions and 10 deletions

View File

@ -179,9 +179,9 @@ void Client::change_buffer(Buffer& buffer)
context().selections_write_only() = std::move(ws.selections); context().selections_write_only() = std::move(ws.selections);
context().set_window(*m_window); context().set_window(*m_window);
m_window->set_dimensions(m_ui->dimensions()); m_window->set_dimensions(m_ui->dimensions());
force_redraw();
m_window->hooks().run_hook("WinDisplay", buffer.name(), context()); m_window->hooks().run_hook("WinDisplay", buffer.name(), context());
force_redraw();
} }
static bool is_inline(InfoStyle style) static bool is_inline(InfoStyle style)

View File

@ -148,18 +148,19 @@ void Context::change_buffer(Buffer& buffer)
if (m_edition_level > 0) if (m_edition_level > 0)
this->buffer().commit_undo_group(); 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()) if (has_input_handler())
input_handler().reset_normal_mode(); 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() SelectionList& Context::selections()