From 06e06d6ea67f10ececd7232471505e7d8f36d509 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 16 Sep 2013 19:15:13 +0100 Subject: 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. --- src/client_manager.cc | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'src/client_manager.cc') 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(); } } -- cgit v1.2.3