diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-02-18 19:03:39 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-02-18 19:03:39 +0100 |
| commit | b08749285e76d77ebdab4ea1c56092438d953ff9 (patch) | |
| tree | ce2c11adc437f1d025acd1e7f1eab03b9993c650 /src/client_manager.cc | |
| parent | b43fdc7eb67f282ff37b98ceb19077185228885b (diff) | |
move status line generation code to client manager
Diffstat (limited to 'src/client_manager.cc')
| -rw-r--r-- | src/client_manager.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/client_manager.cc b/src/client_manager.cc index 62324b7c..519cd00a 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -188,6 +188,24 @@ Context& ClientManager::get_client_context(const String& name) throw runtime_error("no client named: " + name); } +static String generate_status_line(const Context& context) +{ + BufferCoord cursor = context.editor().selections().back().last().coord(); + std::ostringstream oss; + oss << context.buffer().name() + << " " << (int)cursor.line+1 << "," << (int)cursor.column+1; + if (context.buffer().is_modified()) + oss << " [+]"; + if (context.input_handler().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]"; + return oss.str(); +} + void ClientManager::redraw_clients() const { for (auto& client : m_clients) @@ -200,8 +218,9 @@ void ClientManager::redraw_clients() const return; context.window().set_dimensions(dimensions); context.window().update_display_buffer();; + context.ui().draw(context.window().display_buffer(), - context.window().status_line()); + generate_status_line(context)); } } } |
