insert key values as code points in insert mode

This commit is contained in:
Josh Holtrop 2016-10-29 09:12:50 -04:00
parent fe64622762
commit 752d5b2071

View File

@ -249,6 +249,20 @@ void Window::handle_keysym(uint32_t keysym)
} }
void Window::handle_keyval(uint32_t keyval) void Window::handle_keyval(uint32_t keyval)
{
if (m_buffer->piece_table->in_insert_mode())
{
if (keyval == '\033')
{
m_buffer->piece_table->end_insert();
}
else if (keyval <= 0xFFu)
{
m_buffer->piece_table->insert_code_point(keyval);
}
redraw();
}
else
{ {
switch (keyval) switch (keyval)
{ {
@ -283,15 +297,12 @@ void Window::handle_keyval(uint32_t keyval)
case 'i': case 'i':
m_buffer->piece_table->begin_insert(*m_cursor, true); m_buffer->piece_table->begin_insert(*m_cursor, true);
break; break;
case 'o':
m_buffer->piece_table->insert_code_point('*');
redraw();
break;
case 'a': case 'a':
m_buffer->piece_table->begin_insert(*m_cursor, false); m_buffer->piece_table->begin_insert(*m_cursor, false);
break; break;
} }
} }
}
void Window::cursor_move(int which) void Window::cursor_move(int which)
{ {