summaryrefslogtreecommitdiff
path: root/src/client_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-09-16 19:15:13 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-09-16 19:15:13 +0100
commit06e06d6ea67f10ececd7232471505e7d8f36d509 (patch)
tree478b39028f534bb6b89b16ffcffa54c83c61b3c2 /src/client_manager.cc
parent49903523a7f28c18d324bf605876b9d18a97047b (diff)
remove print_status from UserInterface, pass status line to draw
Client store the current status line. This way calls to print status do not force the user interface to display directly.
Diffstat (limited to 'src/client_manager.cc')
-rw-r--r--src/client_manager.cc37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/client_manager.cc b/src/client_manager.cc
index c50d313e..3dd93697 100644
--- a/src/client_manager.cc
+++ b/src/client_manager.cc
@@ -151,45 +151,10 @@ Client& ClientManager::get_client(const String& name)
throw runtime_error("no client named: " + name);
}
-static DisplayLine generate_status_line(Client& client)
-{
- auto& context = client.context();
- auto pos = context.editor().main_selection().last();
- auto col = context.buffer()[pos.line].char_count_to(pos.column);
-
- std::ostringstream oss;
- oss << context.buffer().display_name()
- << " " << (int)pos.line+1 << ":" << (int)col+1;
- if (context.buffer().is_modified())
- oss << " [+]";
- if (context.client().is_recording())
- oss << " [recording]";
- if (context.buffer().flags() & Buffer::Flags::New)
- oss << " [new file]";
- oss << " [" << context.editor().selections().size() << " sel]";
- if (context.editor().is_editing())
- oss << " [insert]";
- oss << " - " << client.name();
- return { oss.str(), get_color("StatusLine") };
-}
-
void ClientManager::redraw_clients() const
{
for (auto& client : m_clients)
- {
- Context& context = client->context();
- if (context.window().timestamp() != context.buffer().timestamp())
- {
- DisplayCoord dimensions = context.ui().dimensions();
- if (dimensions == DisplayCoord{0,0})
- return;
- context.window().set_dimensions(dimensions);
- context.window().update_display_buffer();;
-
- context.ui().draw(context.window().display_buffer(),
- generate_status_line(*client));
- }
- }
+ client->redraw_ifn();
}
}