summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-02-18 19:03:39 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-02-18 19:03:39 +0100
commitb08749285e76d77ebdab4ea1c56092438d953ff9 (patch)
treece2c11adc437f1d025acd1e7f1eab03b9993c650 /src
parentb43fdc7eb67f282ff37b98ceb19077185228885b (diff)
move status line generation code to client manager
Diffstat (limited to 'src')
-rw-r--r--src/client_manager.cc21
-rw-r--r--src/window.cc16
-rw-r--r--src/window.hh2
3 files changed, 20 insertions, 19 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));
}
}
}
diff --git a/src/window.cc b/src/window.cc
index 9435c525..e0f11ab2 100644
--- a/src/window.cc
+++ b/src/window.cc
@@ -171,22 +171,6 @@ DisplayCoord Window::display_position(const BufferIterator& iterator)
return { 0, 0 };
}
-String Window::status_line() const
-{
- BufferCoord cursor = selections().back().last().coord();
- std::ostringstream oss;
- oss << buffer().name()
- << " " << (int)cursor.line+1 << "," << (int)cursor.column+1;
- if (buffer().is_modified())
- oss << " [+]";
- if (buffer().flags() & Buffer::Flags::New)
- oss << " [new file]";
- oss << " [" << selections().size() << " sel]";
- if (is_editing())
- oss << " [insert]";
- return oss.str();
-}
-
void Window::on_option_changed(const String& name, const Option& option)
{
String desc = name + "=" + option.as_string();
diff --git a/src/window.hh b/src/window.hh
index 7eb13860..3e3c187f 100644
--- a/src/window.hh
+++ b/src/window.hh
@@ -38,8 +38,6 @@ public:
DisplayCoord display_position(const BufferIterator& it);
- String status_line() const;
-
HighlighterGroup& highlighters() { return m_highlighters; }
OptionManager& options() { return m_options; }