aboutsummaryrefslogtreecommitdiff
path: root/vt.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-06-07 19:16:38 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-06-08 17:53:26 +0000
commit9d3351472d9d6ef9a4314906fe71bf5fa3ed77bf (patch)
tree646bbd181b8b705bb6ac89c8359e912f13b9854d /vt.c
parentextract: consume spaces following a tab (diff)
vt: TAB: don’t print a ‘\t’ to the grid if the *current* cell isn’t empty
If the cursor is already at the right edge, our logic that checked for non-empty cells failed; it didn’t check the current cell. Fix by initializing ‘emit_tab_char’ to true/false, depending on the contents of the current cell.
Diffstat (limited to 'vt.c')
-rw-r--r--vt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/vt.c b/vt.c
index fe7ec52a..7c884cca 100644
--- a/vt.c
+++ b/vt.c
@@ -174,12 +174,13 @@ action_execute(struct terminal *term, uint8_t c)
xassert(new_col >= start_col);
xassert(new_col < term->cols);
-
- bool emit_tab_char = true;
struct row *row = term->grid->cur_row;
+ bool emit_tab_char = (row->cells[start_col].wc == 0 ||
+ row->cells[start_col].wc == L' ');
+
/* Check if all cells from here until the next tab stop are empty */
- for (const struct cell *cell = &row->cells[start_col];
+ for (const struct cell *cell = &row->cells[start_col + 1];
cell < &row->cells[new_col];
cell++)
{