diff --git a/src/core/utf8.c b/src/core/utf8.c index cdb272f5..9faaac89 100644 --- a/src/core/utf8.c +++ b/src/core/utf8.c @@ -399,6 +399,20 @@ int unichar_array_find_cluster_start(const unichar *text, int text_len, int pos) #endif } +int is_combining_char(unichar c) +{ + if (!is_utf8()) + return 0; + +#ifdef HAVE_LIBUTF8PROC + /* Use utf8proc for precise combining character detection */ + return unichar_isprint(c) && utf8proc_charwidth(c) == 0; +#else + /* Fallback to unichar_width for compatibility */ + return unichar_isprint(c) && unichar_width(c) == 0; +#endif +} + void utf8_init(void) { /* no-op */ diff --git a/src/core/utf8.h b/src/core/utf8.h index 2893f58d..694e1bdf 100644 --- a/src/core/utf8.h +++ b/src/core/utf8.h @@ -72,6 +72,10 @@ int unichar_array_move_cluster_backward(const unichar *text, int text_len, int * * Returns the codepoint index of the cluster start. */ int unichar_array_find_cluster_start(const unichar *text, int text_len, int pos); +/* Check if a unichar is a combining character (width 0). + * Returns 1 if the character is combining, 0 otherwise. */ +int is_combining_char(unichar c); + /* Initialize UTF-8 debugging system */ void utf8_init(void); diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 69c5d942..243ec49f 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -54,20 +54,6 @@ static unichar i_tolower(unichar c) return c <= 255 ? tolower(c) : c; } -static int is_combining_char(unichar c) -{ - if (term_type != TERM_TYPE_UTF8) - return 0; - -#ifdef HAVE_LIBUTF8PROC - /* Use utf8proc for precise combining character detection */ - return unichar_isprint(c) && utf8proc_charwidth(c) == 0; -#else - /* Fallback to unichar_width for compatibility */ - return unichar_isprint(c) && unichar_width(c) == 0; -#endif -} - static int i_isalnum(unichar c) { if (term_type == TERM_TYPE_UTF8)