input_stop_utf8 can move the cursor, so it is now wrong to store the

cursor position before calling it. Problem found by Jayakrishna
Vadayath.
This commit is contained in:
nicm
2025-08-26 07:15:00 +00:00
parent 3520e833a4
commit ca0f0419e6

View File

@ -1234,7 +1234,7 @@ input_c0_dispatch(struct input_ctx *ictx)
struct window_pane *wp = ictx->wp; struct window_pane *wp = ictx->wp;
struct screen *s = sctx->s; struct screen *s = sctx->s;
struct grid_cell gc, first_gc; struct grid_cell gc, first_gc;
u_int cx = s->cx, line = s->cy + s->grid->hsize; u_int cx, line;
u_int width; u_int width;
int has_content = 0; int has_content = 0;
@ -1254,11 +1254,13 @@ input_c0_dispatch(struct input_ctx *ictx)
break; break;
case '\011': /* HT */ case '\011': /* HT */
/* Don't tab beyond the end of the line. */ /* Don't tab beyond the end of the line. */
if (s->cx >= screen_size_x(s) - 1) cx = s->cx;
if (cx >= screen_size_x(s) - 1)
break; break;
/* Find the next tab point, or use the last column if none. */ /* Find the next tab point, or use the last column if none. */
grid_get_cell(s->grid, s->cx, line, &first_gc); line = s->cy + s->grid->hsize;
grid_get_cell(s->grid, cx, line, &first_gc);
do { do {
if (!has_content) { if (!has_content) {
grid_get_cell(s->grid, cx, line, &gc); grid_get_cell(s->grid, cx, line, &gc);