terminal: Add escape handling for CUB

This VT102 command is triggered by busybox when pressing the 'pos1' key.
This commit is contained in:
Christian Prochaska 2013-03-22 20:15:40 +01:00 committed by Norman Feske
parent cae79d30b8
commit ff3b73825d
5 changed files with 19 additions and 0 deletions

View File

@ -77,6 +77,10 @@ class Static_character_screen : public Terminal::Character_screen
{
}
void cub(int)
{
}
void cuf(int)
{
if (_cursor_pos.x >= _boundary.width)

View File

@ -236,6 +236,14 @@ class Char_cell_array_character_screen : public Terminal::Character_screen
_region_end = Genode::max(_region_end, _region_start);
}
void cub(int dx)
{
Cursor_guard guard(*this);
_cursor_pos.x -= dx;
_cursor_pos.x = Genode::max(0, _cursor_pos.x);
}
void cuf(int dx)
{
Cursor_guard guard(*this);

View File

@ -61,6 +61,11 @@ namespace Terminal {
*/
virtual void csr(int, int) = 0;
/**
* Move cursor backwards
*/
virtual void cub(int) = 0;
/**
* Non-destructive space - move right #1 spaces
*/

View File

@ -37,6 +37,7 @@ namespace Terminal {
CS_TRACE_OP(cvvis);
CS_TRACE_OP(cpr);
CS_TRACE_OP_2(csr);
CS_TRACE_OP_1(cub);
CS_TRACE_OP(cuf1);
CS_TRACE_OP_2(cup);
CS_TRACE_OP(cuu1);

View File

@ -257,6 +257,7 @@ namespace Terminal {
if (starts_with_digit(4, p1))
return (_screen.setab(remove_first_digit(p1)), true);
case 'D': return (_screen.cub(p1), true);
case 'd': return (_screen.vpa(p1), true);
case 'g': return (p1 == 3) && (_screen.tbc(), true);
case 'G': return (_screen.hpa(p1), true);