diff --git a/src/client.cc b/src/client.cc index 3397de15..5bc73c45 100644 --- a/src/client.cc +++ b/src/client.cc @@ -145,12 +145,11 @@ void Client::redraw_ifn() { Face default_face = get_face("Default"); - if (context().window().needs_redraw(context())) - { - context().window().update_display_buffer(context()); + Window& window = context().window(); + UserInterface& ui = context().ui(); - context().ui().draw(context().window().display_buffer(), default_face); - } + if (window.needs_redraw(context())) + ui.draw(window.update_display_buffer(context()), default_face); DisplayLine mode_line = generate_mode_line(); if (m_status_line.atoms() != m_pending_status_line.atoms() or @@ -159,10 +158,10 @@ void Client::redraw_ifn() m_mode_line = std::move(mode_line); m_status_line = m_pending_status_line; - context().ui().draw_status(m_status_line, m_mode_line, default_face); + ui.draw_status(m_status_line, m_mode_line, default_face); } - context().ui().refresh(); + ui.refresh(); } void Client::reload_buffer() diff --git a/src/window.cc b/src/window.cc index 75b90b51..f16a4a3b 100644 --- a/src/window.cc +++ b/src/window.cc @@ -79,14 +79,14 @@ bool Window::needs_redraw(const Context& context) const return hash != m_hash; } -void Window::update_display_buffer(const Context& context) +const DisplayBuffer& Window::update_display_buffer(const Context& context) { DisplayBuffer::LineList& lines = m_display_buffer.lines(); lines.clear(); m_dimensions = context.ui().dimensions(); if (m_dimensions == CharCoord{0,0}) - return; + return m_display_buffer; kak_assert(&buffer() == &context.buffer()); scroll_to_keep_selection_visible_ifn(context); @@ -110,6 +110,8 @@ void Window::update_display_buffer(const Context& context) m_display_buffer.optimize(); m_hash = compute_hash(context); + + return m_display_buffer; } void Window::set_position(CharCoord position) diff --git a/src/window.hh b/src/window.hh index 9fb1a971..4a3d3701 100644 --- a/src/window.hh +++ b/src/window.hh @@ -23,13 +23,12 @@ public: const CharCoord& dimensions() const { return m_dimensions; } void set_dimensions(CharCoord dimensions); - const DisplayBuffer& display_buffer() const { return m_display_buffer; } - void center_line(LineCount buffer_line); void display_line_at(LineCount buffer_line, LineCount display_line); void scroll(LineCount offset); void scroll(CharCount offset); - void update_display_buffer(const Context& context); + + const DisplayBuffer& update_display_buffer(const Context& context); CharCoord display_position(ByteCoord coord) const; ByteCoord buffer_coord(CharCoord coord) const;