diff --git a/src/main.cc b/src/main.cc index f71657026..19ff9e0f5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -123,6 +123,16 @@ void draw_window(Window& window) clrtoeol(); addch('~'); } + move(max_y, 0); + + set_attribute(A_UNDERLINE, 0); + set_attribute(A_REVERSE, 0); + set_attribute(A_BLINK, 0); + set_attribute(A_BOLD, 0); + set_color(Color::Cyan, Color::Black); + + clrtoeol(); + addstr(window.status_line().c_str()); const WindowCoord& cursor_position = window.cursor_position(); move(cursor_position.line, cursor_position.column); diff --git a/src/window.cc b/src/window.cc index 86be7d182..f75c08b1e 100644 --- a/src/window.cc +++ b/src/window.cc @@ -4,6 +4,7 @@ #include "filters.hh" #include +#include namespace Kakoune { @@ -327,6 +328,26 @@ void Window::scroll_to_keep_cursor_visible_ifn() } } +std::string Window::status_line() const +{ + BufferCoord cursor = window_to_buffer(cursor_position()); + std::ostringstream oss; + oss << m_buffer.name() << " -- " << cursor.line << "," << cursor.column + << " -- " << m_selections.size() << " sel -- "; + switch (m_select_mode) + { + case SelectMode::Normal: + oss << "[Normal]"; + break; + case SelectMode::Append: + oss << "[Append]"; + break; + default: + assert(false); + } + return oss.str(); +} + IncrementalInserter::IncrementalInserter(Window& window, Mode mode) : m_window(window) { diff --git a/src/window.hh b/src/window.hh index cba501675..a5ea7a089 100644 --- a/src/window.hh +++ b/src/window.hh @@ -86,6 +86,8 @@ public: SelectMode select_mode() const { return m_select_mode; } void set_select_mode(SelectMode select_mode) { m_select_mode = select_mode; } + std::string status_line() const; + private: friend class Buffer;