term: do not allow codepoint merging into grapheme clusters directly after a cursor move

That is, only do grapheme clustering when printing codepoints in
sequence, without any cursor movements in between.

Closes #2383
This commit is contained in:
Daniel Eklöf 2026-06-12 15:34:12 +02:00
parent f66a020bba
commit d7742d0312
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 21 additions and 1 deletions

View file

@ -264,6 +264,7 @@ struct vt {
char32_t last_printed;
#if defined(FOOT_GRAPHEME_CLUSTERING)
utf8proc_int32_t grapheme_state;
bool codepoint_merging_ok;
#endif
char32_t utf8;
struct {
@ -994,5 +995,6 @@ static inline void term_reset_grapheme_state(struct terminal *term)
{
#if defined(FOOT_GRAPHEME_CLUSTERING)
term->vt.grapheme_state = 0;
term->vt.codepoint_merging_ok = false;
#endif
}