From 045f55a8c61480eff5e43061ee7ffd1207092889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 17 Nov 2019 10:15:56 +0100 Subject: [PATCH] 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). --- vt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vt.c b/vt.c index 36c15fc8..cad4cbcf 100644 --- a/vt.c +++ b/vt.c @@ -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; }