diff --git a/src/gui/BufferPane.cc b/src/gui/BufferPane.cc index 377922a..4d50aba 100644 --- a/src/gui/BufferPane.cc +++ b/src/gui/BufferPane.cc @@ -9,6 +9,8 @@ BufferPane::BufferPane(Window * window, std::shared_ptr buffer) m_target_column = 0; m_cursor_virtual_column = 0; m_show_status_bar = true; + m_command_mode = false; + m_focused = false; } void BufferPane::resize(int width, int height) @@ -393,6 +395,10 @@ void BufferPane::draw_buffer_character(int screen_column, int screen_row, uint32 void BufferPane::draw_cursor(int x, int y) { + if (m_command_mode && (!m_focused)) + { + return; + } int width = m_window->font()->get_advance(); int height = m_window->font()->get_line_height(); if (insert_mode()) @@ -721,3 +727,9 @@ void BufferPane::redo() m_buffer->redo(); m_window->request_redraw(); } + +void BufferPane::set_command_mode() +{ + m_command_mode = true; + set_show_status_bar(false); +} diff --git a/src/gui/BufferPane.h b/src/gui/BufferPane.h index b59e6ea..35cea05 100644 --- a/src/gui/BufferPane.h +++ b/src/gui/BufferPane.h @@ -29,6 +29,8 @@ public: { m_show_status_bar = show_status_bar; } + void set_command_mode(); + void set_focused(bool focused); protected: int effective_scroll_offset() @@ -77,6 +79,8 @@ protected: std::list> m_screen_lines; int m_target_column; bool m_show_status_bar; + bool m_command_mode; + bool m_focused; }; #endif diff --git a/src/gui/Window.cc b/src/gui/Window.cc index 1ce7b3b..819caf3 100644 --- a/src/gui/Window.cc +++ b/src/gui/Window.cc @@ -121,6 +121,9 @@ bool Window::create(std::shared_ptr buffer) glClearColor (0.0, 0.0, 0.0, 0.0); m_buffer_pane = std::make_shared(this, buffer); + m_command_buffer = std::make_shared(); + m_command_buffer_pane = std::make_shared(this, m_command_buffer); + m_command_buffer_pane->set_command_mode(); resize(); @@ -365,8 +368,11 @@ void Window::resize() SDL_GetWindowSize(m_window, &m_width, &m_height); glViewport(0, 0, m_width, m_height); m_gl->resize(m_width, m_height); - m_buffer_pane->move(0, 0); - m_buffer_pane->resize(m_width, m_height); + int line_height = m_font->get_line_height(); + m_buffer_pane->move(0, line_height + 1); + m_buffer_pane->resize(m_width, m_height - line_height - 1); + m_command_buffer_pane->resize(m_width, line_height); + m_command_buffer_pane->move(0, 0); } void Window::redraw() @@ -374,6 +380,8 @@ void Window::redraw() glClear(GL_COLOR_BUFFER_BIT); m_buffer_pane->draw(); + m_gl->draw_rect(0, m_font->get_line_height(), m_width, 1, 0.5, 0.5, 0.5, 1.0); + m_command_buffer_pane->draw(); SDL_GL_SwapWindow(m_window); } diff --git a/src/gui/Window.h b/src/gui/Window.h index f080d83..1e3b2c4 100644 --- a/src/gui/Window.h +++ b/src/gui/Window.h @@ -85,6 +85,8 @@ protected: std::shared_ptr m_gl; std::shared_ptr m_buffer_pane; + std::shared_ptr m_command_buffer; + std::shared_ptr m_command_buffer_pane; Uint16 m_keymod; };