Draw command characters as they are input
This commit is contained in:
parent
2dcf13c8fa
commit
c2b50a3f4f
@ -135,6 +135,7 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
|
|||||||
m_command_buffer_pane = std::make_shared<BufferPane>(this, m_command_buffer);
|
m_command_buffer_pane = std::make_shared<BufferPane>(this, m_command_buffer);
|
||||||
m_command_buffer_pane->set_command_mode();
|
m_command_buffer_pane->set_command_mode();
|
||||||
m_command_buffer_screen_rows = 1;
|
m_command_buffer_screen_rows = 1;
|
||||||
|
m_command_invalid = false;
|
||||||
|
|
||||||
resize(INITIAL_WIDTH, INITIAL_HEIGHT);
|
resize(INITIAL_WIDTH, INITIAL_HEIGHT);
|
||||||
|
|
||||||
@ -456,11 +457,39 @@ void Window::redraw()
|
|||||||
|
|
||||||
m_buffer_pane->draw();
|
m_buffer_pane->draw();
|
||||||
m_gl->draw_rect(0, m_command_buffer_screen_rows * m_font->get_line_height(), m_width, 1, 0.5, 0.5, 0.5, 1.0);
|
m_gl->draw_rect(0, m_command_buffer_screen_rows * m_font->get_line_height(), m_width, 1, 0.5, 0.5, 0.5, 1.0);
|
||||||
m_command_buffer_pane->draw();
|
if (m_focused_buffer_pane->insert_mode())
|
||||||
|
{
|
||||||
|
m_command_buffer_pane->draw();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
draw_command_input();
|
||||||
|
}
|
||||||
|
|
||||||
Jtk_SwapBuffers(m_window);
|
Jtk_SwapBuffers(m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::draw_command_input()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
float g, b;
|
||||||
|
if (m_command_invalid)
|
||||||
|
{
|
||||||
|
g = 0.0;
|
||||||
|
b = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g = 1.0;
|
||||||
|
b = 1.0;
|
||||||
|
}
|
||||||
|
for (size_t i = 0u, length = m_command_input.size(); i < length; i++)
|
||||||
|
{
|
||||||
|
m_gl->draw_character(x, 0, m_command_input[i], *m_font, 1.0, g, b, 1.0);
|
||||||
|
x += m_font->get_advance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Window::change_focus(std::shared_ptr<BufferPane> buffer_pane)
|
void Window::change_focus(std::shared_ptr<BufferPane> buffer_pane)
|
||||||
{
|
{
|
||||||
m_focused_buffer_pane->set_focused(false);
|
m_focused_buffer_pane->set_focused(false);
|
||||||
|
@ -51,6 +51,7 @@ protected:
|
|||||||
void handle_command(const EncodedString & command);
|
void handle_command(const EncodedString & command);
|
||||||
void evaluate_command_input();
|
void evaluate_command_input();
|
||||||
void execute_command(const Command & command);
|
void execute_command(const Command & command);
|
||||||
|
void draw_command_input();
|
||||||
|
|
||||||
void command_write_file(const CommandParser & cp);
|
void command_write_file(const CommandParser & cp);
|
||||||
void command_quit(const CommandParser & cp);
|
void command_quit(const CommandParser & cp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user