From 483b2b3edb0d01cde0aa3fa6aa7a02bdd90b8026 Mon Sep 17 00:00:00 2001 From: nicm <nicm> Date: Mon, 24 Mar 2025 20:17:24 +0000 Subject: [PATCH] Correctly skip wide characters in hyperlinks, from someone in GitHub issue 4425. --- format.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/format.c b/format.c index 13e7f149..a454a031 100644 --- a/format.c +++ b/format.c @@ -5428,9 +5428,14 @@ format_grid_hyperlink(struct grid *gd, u_int x, u_int y, struct screen* s) const char *uri; struct grid_cell gc; - grid_get_cell(gd, x, y, &gc); - if (gc.flags & GRID_FLAG_PADDING) - return (NULL); + for (;;) { + grid_get_cell(gd, x, y, &gc); + if (~gc.flags & GRID_FLAG_PADDING) + break; + if (x == 0) + return (NULL); + x--; + } if (s->hyperlinks == NULL || gc.link == 0) return (NULL); if (!hyperlinks_get(s->hyperlinks, gc.link, &uri, NULL, NULL))