Fix redrawing of windows when only the status line changes

This commit is contained in:
Maxime Coste 2014-07-07 20:13:08 +01:00
parent 90c2647c0b
commit 55866b51d7
3 changed files with 21 additions and 8 deletions

View File

@ -88,16 +88,21 @@ void Client::change_buffer(Buffer& buffer)
void Client::redraw_ifn()
{
if (context().window().timestamp() != context().buffer().timestamp())
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())
{
CharCoord dimensions = context().ui().dimensions();
if (dimensions == CharCoord{0,0})
return;
context().window().set_dimensions(dimensions);
context().window().update_display_buffer(context());
if (buffer_changed)
{
CharCoord dimensions = context().ui().dimensions();
if (dimensions == CharCoord{0,0})
return;
context().window().set_dimensions(dimensions);
context().window().update_display_buffer(context());
}
m_mode_line = std::move(mode_line);
context().ui().draw(context().window().display_buffer(),
m_status_line, generate_mode_line());
m_status_line, m_mode_line);
}
context().ui().refresh();
}

View File

@ -53,6 +53,7 @@ private:
InputHandler m_input_handler;
DisplayLine m_status_line;
DisplayLine m_mode_line;
};
}

View File

@ -105,6 +105,13 @@ public:
void trim_end(CharCount count);
void check_invariant() const;
bool operator==(const DisplayAtom& other) const
{
return colors == other.colors or attribute == other.attribute or
content() == other.content();
}
public:
ColorPair colors = {Colors::Default, Colors::Default};
Attribute attribute = Normal;