Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2024-10-25 18:01:11 +01:00
8 changed files with 125 additions and 25 deletions

27
input.c
View File

@ -1213,6 +1213,10 @@ input_c0_dispatch(struct input_ctx *ictx)
struct screen_write_ctx *sctx = &ictx->ctx;
struct window_pane *wp = ictx->wp;
struct screen *s = sctx->s;
struct grid_cell gc, first_gc;
u_int cx = s->cx, line = s->cy + s->grid->hsize;
u_int width;
int has_content = 0;
ictx->utf8started = 0; /* can't be valid UTF-8 */
@ -1234,11 +1238,28 @@ input_c0_dispatch(struct input_ctx *ictx)
break;
/* Find the next tab point, or use the last column if none. */
grid_get_cell(s->grid, s->cx, line, &first_gc);
do {
s->cx++;
if (bit_test(s->tabs, s->cx))
if (!has_content) {
grid_get_cell(s->grid, cx, line, &gc);
if (gc.data.size != 1 ||
*gc.data.data != ' ' ||
!grid_cells_look_equal(&gc, &first_gc))
has_content = 1;
}
cx++;
if (bit_test(s->tabs, cx))
break;
} while (s->cx < screen_size_x(s) - 1);
} while (cx < screen_size_x(s) - 1);
width = cx - s->cx;
if (has_content || width > sizeof gc.data.data)
s->cx = cx;
else {
grid_get_cell(s->grid, s->cx, line, &gc);
grid_set_tab(&gc, width);
screen_write_collect_add(sctx, &gc);
}
break;
case '\012': /* LF */
case '\013': /* VT */