From e2b3dd0ca4b71fd7cfcceeba35b97497631e72bd Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 12 Aug 2014 19:19:46 +0100 Subject: [PATCH] Tweak client redraw logic, avoid highlight if only status line changed --- src/client.cc | 8 +++++--- src/client.hh | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client.cc b/src/client.cc index c3218b774..d40791b5b 100644 --- a/src/client.cc +++ b/src/client.cc @@ -42,8 +42,7 @@ void Client::handle_available_input() void Client::print_status(DisplayLine status_line) { - m_status_line = std::move(status_line); - context().window().forget_timestamp(); + m_pending_status_line = std::move(status_line); } DisplayLine Client::generate_mode_line() const @@ -92,7 +91,9 @@ void Client::redraw_ifn() { DisplayLine mode_line = generate_mode_line(); const bool buffer_changed = context().window().timestamp() != context().buffer().timestamp(); - if (buffer_changed or mode_line.atoms() != m_mode_line.atoms()) + const bool mode_line_changed = mode_line.atoms() != m_mode_line.atoms(); + const bool status_line_changed = m_status_line.atoms() != m_pending_status_line.atoms(); + if (buffer_changed or status_line_changed or mode_line_changed) { if (buffer_changed) { @@ -103,6 +104,7 @@ void Client::redraw_ifn() context().window().update_display_buffer(context()); } m_mode_line = std::move(mode_line); + m_status_line = m_pending_status_line; context().ui().draw(context().window().display_buffer(), m_status_line, m_mode_line); } diff --git a/src/client.hh b/src/client.hh index 3f8ee4b60..664728083 100644 --- a/src/client.hh +++ b/src/client.hh @@ -54,6 +54,7 @@ private: InputHandler m_input_handler; DisplayLine m_status_line; + DisplayLine m_pending_status_line; DisplayLine m_mode_line; };