aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-02-03 14:31:03 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-02-06 13:02:38 +0000
commit98402040977435b0029dbe4952c083e65eb8ef69 (patch)
tree76c4cbd96ca9af707f7d9031ff1b0cd805490bb6 /terminal.c
parentosc: text-size: disable optimization (diff)
term: print-non-ascii: propagate existing forced-width
When appending to an existing composed character, "inherit" its forced width, if set. Also make sure to actually _use_ the forced width, if set, rather than the calculated width. This fixes an issue when appending zero-width codepoints to a forced-width combining character.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index 96a215ba..c8e49663 100644
--- a/terminal.c
+++ b/terminal.c
@@ -4255,7 +4255,7 @@ term_process_and_print_non_ascii(struct terminal *term, char32_t wc)
new_cc->count = wanted_count;
new_cc->chars[0] = base;
new_cc->chars[wanted_count - 1] = wc;
- new_cc->forced_width = 0;
+ new_cc->forced_width = composed != NULL ? composed->forced_width : 0;
if (composed != NULL) {
memcpy(&new_cc->chars[1], &composed->chars[1],
@@ -4313,7 +4313,7 @@ term_process_and_print_non_ascii(struct terminal *term, char32_t wc)
composed_insert(&term->composed, new_cc);
wc = CELL_COMB_CHARS_LO + new_cc->key;
- width = new_cc->width;
+ width = new_cc->forced_width > 0 ? new_cc->forced_width : new_cc->width;
xassert(wc >= CELL_COMB_CHARS_LO);
xassert(wc <= CELL_COMB_CHARS_HI);