aboutsummaryrefslogtreecommitdiff
path: root/vt.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-16 09:57:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-16 09:57:39 +0000
commit65ff3656f70735f6fcaee05c652004f1d4c717e8 (patch)
tree065e0096a956c62752d7c4d575d5335aa1ae22c1 /vt.c
parentvt: implement ESC H - set tab stop at current column (diff)
vt: execute: \t: use tab stops from tab stop list
Instead of assuming hardcoded 8-width tab stops, use the tab stops from the tab stop list.
Diffstat (limited to 'vt.c')
-rw-r--r--vt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/vt.c b/vt.c
index 73bc6262..79e9871e 100644
--- a/vt.c
+++ b/vt.c
@@ -866,9 +866,14 @@ action(struct terminal *term, enum action _action, uint8_t c)
case '\x09': {
/* HT - horizontal tab */
- int col = term->cursor.col;
- col = (col + 8) / 8 * 8;
- term_cursor_right(term, col - term->cursor.col);
+ int new_col = term->cursor.col;
+ tll_foreach(term->tab_stops, it) {
+ if (it->item >= term->cursor.col) {
+ new_col = it->item;
+ break;
+ }
+ }
+ term_cursor_right(term, new_col - term->cursor.col);
break;
}