mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
vt: execute: implement HT - horizontal tab
This commit is contained in:
parent
3a97fce6d0
commit
dbd883935b
1 changed files with 13 additions and 1 deletions
14
vt.c
14
vt.c
|
|
@ -604,6 +604,7 @@ action(struct terminal *term, enum action action, uint8_t c)
|
||||||
LOG_DBG("execute: 0x%02x", c);
|
LOG_DBG("execute: 0x%02x", c);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\n':
|
case '\n':
|
||||||
|
/* LF - line feed */
|
||||||
if (term->grid.cursor.row == term->grid.scroll_region.end - 1) {
|
if (term->grid.cursor.row == term->grid.scroll_region.end - 1) {
|
||||||
grid_scroll(&term->grid, 1);
|
grid_scroll(&term->grid, 1);
|
||||||
} else
|
} else
|
||||||
|
|
@ -611,19 +612,30 @@ action(struct terminal *term, enum action action, uint8_t c)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\r':
|
case '\r':
|
||||||
|
/* FF - form feed */
|
||||||
grid_cursor_left(&term->grid, term->grid.cursor.col);
|
grid_cursor_left(&term->grid, term->grid.cursor.col);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\b':
|
case '\b':
|
||||||
|
/* backspace */
|
||||||
grid_cursor_left(&term->grid, 1);
|
grid_cursor_left(&term->grid, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\x07':
|
case '\x07':
|
||||||
|
/* BEL */
|
||||||
LOG_WARN("BELL");
|
LOG_WARN("BELL");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '\x09': {
|
||||||
|
/* HT - horizontal tab */
|
||||||
|
int col = term->grid.cursor.col;
|
||||||
|
col = (col + 8) / 8 * 8;
|
||||||
|
grid_cursor_right(&term->grid, col - term->grid.cursor.col);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_ERR("execute: unimplemented: %c", c);
|
LOG_ERR("execute: unimplemented: %c (0x%02x)", c, c);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue