get ready to handle commands entered
This commit is contained in:
parent
3bcc360c81
commit
37d27d6063
@ -4,6 +4,7 @@
|
|||||||
#include "BufferPane.h"
|
#include "BufferPane.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "jes_icon-32x32.h"
|
#include "jes_icon-32x32.h"
|
||||||
|
#include "CommandParser.h"
|
||||||
|
|
||||||
#define INITIAL_WIDTH 800
|
#define INITIAL_WIDTH 800
|
||||||
#define INITIAL_HEIGHT 800
|
#define INITIAL_HEIGHT 800
|
||||||
@ -323,9 +324,11 @@ void Window::handle_keyval(uint32_t keyval)
|
|||||||
{
|
{
|
||||||
if ((keyval == '\n') && (m_focused_buffer_pane == m_command_buffer_pane))
|
if ((keyval == '\n') && (m_focused_buffer_pane == m_command_buffer_pane))
|
||||||
{
|
{
|
||||||
|
EncodedString command = m_command_buffer->get_string();
|
||||||
m_command_buffer_pane->clear();
|
m_command_buffer_pane->clear();
|
||||||
m_command_buffer_screen_rows = 1;
|
m_command_buffer_screen_rows = 1;
|
||||||
change_focus(m_buffer_pane);
|
change_focus(m_buffer_pane);
|
||||||
|
handle_command(command);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -565,3 +568,22 @@ void Window::change_focus(std::shared_ptr<BufferPane> buffer_pane)
|
|||||||
m_focused_buffer_pane->set_focused(true);
|
m_focused_buffer_pane->set_focused(true);
|
||||||
request_redraw();
|
request_redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::handle_command(const EncodedString & command)
|
||||||
|
{
|
||||||
|
CommandParser cp;
|
||||||
|
if (cp.parse(command))
|
||||||
|
{
|
||||||
|
if (cp.size() >= 1)
|
||||||
|
{
|
||||||
|
if (cp[0] == "w")
|
||||||
|
{
|
||||||
|
/* TODO */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* TODO: handle command parsing failure */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "GL.h"
|
#include "GL.h"
|
||||||
|
#include "EncodedString.h"
|
||||||
|
|
||||||
class BufferPane;
|
class BufferPane;
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ protected:
|
|||||||
uint32_t get_shifted(uint32_t keysym);
|
uint32_t get_shifted(uint32_t keysym);
|
||||||
void change_focus(std::shared_ptr<BufferPane> buffer_pane);
|
void change_focus(std::shared_ptr<BufferPane> buffer_pane);
|
||||||
void set_window_icon();
|
void set_window_icon();
|
||||||
|
void handle_command(const EncodedString & command);
|
||||||
|
|
||||||
SDL_Window * m_window;
|
SDL_Window * m_window;
|
||||||
bool m_exit_requested;
|
bool m_exit_requested;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user