mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-12 05:34:01 -04:00
csi: fix bad implementation of CBT (back tab)
* It takes a parameter, that indicates the number of tab stops to move through * Use the tab stops defined in the tab stops list, not hard coded mod 8 columns.
This commit is contained in:
parent
ca58c4c621
commit
616e506f2e
2 changed files with 14 additions and 6 deletions
19
csi.c
19
csi.c
|
|
@ -611,13 +611,20 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Z': {
|
case 'Z':
|
||||||
/* Back tab */
|
/* CBT - Back tab (param is number of tab stops to move back through) */
|
||||||
int col = term->cursor.point.col;
|
for (int i = 0; i < vt_param_get(term, 0, 1); i++) {
|
||||||
col = (col - 8 + 7) / 8 * 8;
|
int new_col = 0;
|
||||||
term_cursor_right(term, col - term->cursor.point.col);
|
tll_rforeach(term->tab_stops, it) {
|
||||||
|
if (it->item < term->cursor.point.col) {
|
||||||
|
new_col = it->item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(term->cursor.point.col >= new_col);
|
||||||
|
term_cursor_left(term, term->cursor.point.col - new_col);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
/* Set mode */
|
/* Set mode */
|
||||||
|
|
|
||||||
1
vt.c
1
vt.c
|
|
@ -875,6 +875,7 @@ action(struct terminal *term, enum action _action, uint8_t c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(new_col >= term->cursor.point.col);
|
||||||
term_cursor_right(term, new_col - term->cursor.point.col);
|
term_cursor_right(term, new_col - term->cursor.point.col);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue