vt: bug (tab regression): don't get stuck on the same tab stop

There were actually two bugs here:

* When checking for a tab stop, make sure the new tab stop is at a
  different column. Otherwise you can't tab away from a tab stop.

* When there aren't any tab stops configured, or when we're already
  beyond the last tab stop, then tab to the last column (at least I
  think that's what we're supposed to do).
This commit is contained in:
Daniel Eklöf 2019-11-17 10:15:56 +01:00
parent c9ebd527cf
commit 045f55a8c6
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

4
vt.c
View file

@ -868,9 +868,9 @@ action(struct terminal *term, enum action _action, uint8_t c)
case '\x09': {
/* HT - horizontal tab */
int new_col = term->cursor.point.col;
int new_col = term->cols - 1;
tll_foreach(term->tab_stops, it) {
if (it->item >= term->cursor.point.col) {
if (it->item > term->cursor.point.col) {
new_col = it->item;
break;
}