Support for tab characters in terminal

This commit is contained in:
Norman Feske 2012-03-19 17:09:54 +01:00
parent 5b6de825e6
commit a215d05db8
1 changed files with 11 additions and 2 deletions

View File

@ -300,8 +300,9 @@ class Char_cell_array_character_screen : public Terminal::Character_screen
Cursor_visibility _cursor_visibility;
int _region_start;
int _region_end;
int _tab_size;
enum { DEFAULT_COLOR_INDEX = 4 };
enum { DEFAULT_COLOR_INDEX = 4, DEFAULT_TAB_SIZE = 8 };
struct Cursor_guard
{
@ -343,7 +344,8 @@ class Char_cell_array_character_screen : public Terminal::Character_screen
_highlight(false),
_cursor_visibility(CURSOR_VISIBLE),
_region_start(0),
_region_end(_boundary.height - 1)
_region_end(_boundary.height - 1),
_tab_size(DEFAULT_TAB_SIZE)
{ }
@ -404,6 +406,13 @@ class Char_cell_array_character_screen : public Terminal::Character_screen
break;
}
case 9: /* tab */
{
Cursor_guard guard(*this);
_cursor_pos.x += _tab_size - (_cursor_pos.x % _tab_size);
break;
}
default:
break;
}