From 696a16cca27408f7d073d097efa4f763b614aef9 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 21 Aug 2026 09:53:04 +0000 Subject: [PATCH] Use correct X position when combining characters, GitHub issue 5511 from Francesc Rosas. --- screen-write.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/screen-write.c b/screen-write.c index 990ef4e0f..22b555bd5 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.287 2026/08/17 20:04:00 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.288 2026/08/21 09:53:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2760,10 +2760,11 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc) struct grid *gd = s->grid; const struct utf8_data *ud = &gc->data; struct options *oo = global_options; - u_int i, n, cx = s->cx, cy = s->cy, vis, yoff = 0; + u_int i, n, cx = s->cx, cy = s->cy, vis; struct grid_cell last; struct tty_ctx ttyctx; int force_wide = 0, zero_width = 0; + int xoff = 0, yoff = 0; struct visible_ranges *r; /* Ignore U+3164 HANGUL_FILLER entirely. */ @@ -2857,9 +2858,11 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc) * obscured in the middle, only on left or right, but there could be an * empty range in the visible ranges so we add them all up. */ - if (wp != NULL) + if (wp != NULL) { + xoff = wp->xoff; yoff = wp->yoff; - r = window_visible_ranges(wp, cx - n, cy + yoff, n, NULL); + } + r = window_visible_ranges(wp, xoff + cx - n, cy + yoff, n, NULL); for (i = 0, vis = 0; i < r->used; i++) vis += r->ranges[i].nx; if (vis < n) {