From 76503fb86a8b8a6b5c3ce1be87c15a55af38508d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 16 Feb 2025 07:25:25 +0100 Subject: term: append zero-width grapheme breaking characters to previous cell When compiled with grapheme clustering support, zero-width characters that also are grapheme breaks, were ignored (not stored in the grid). When utf8proc says the character is a grapheme break, we try to print the character to the current cell. But this is only done when width > 0. As a result, zero width grapheme breaks were simply discarded. This only happens when grapheme clustering is enabled; when disabled, all zero width characters are appended. Fix this by also requiring the width to be non-zero when if we should append the character or not. Closes #1960 --- terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index c8e49663..2e868793 100644 --- a/terminal.c +++ b/terminal.c @@ -4153,7 +4153,7 @@ term_process_and_print_non_ascii(struct terminal *term, char32_t wc) if (grapheme_clustering) { /* Check if we're on a grapheme cluster break */ if (utf8proc_grapheme_break_stateful( - last, wc, &term->vt.grapheme_state)) + last, wc, &term->vt.grapheme_state) && width > 0) { term_reset_grapheme_state(term); goto out; -- cgit v1.3