From 2cec7aae44579d9d8ca8c7e728f9eb6e2840d72f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 22 Apr 2008 15:08:04 +0000 Subject: 24861 (with tweaks): logic to use alternative wcwidth() if needed; slightly improve test for overwriting with combining characters. --- Src/Zle/zle_misc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Src/Zle/zle_misc.c') diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index d3a9413f3..554830244 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -59,10 +59,16 @@ doinsert(ZLE_STRING_T zstr, int len) * (i.e. even if control, or double width, or with combining * characters) is treated as 1 for the purpose of replacing * what's there already. + * + * This can cause inserting of a combining character in + * places where it should overwrite, such as the start + * of a line. However, combining characters aren't + * useful there anyway and this doesn't cause any + * particular harm. */ for (i = 0, count = 0; i < len; i++) { - int width = wcwidth(zstr[i]); - count += (width != 0) ? 1 : 0; + if (!IS_COMBINING(zstr[i])) + count++; } /* * Ensure we replace a complete combining character -- cgit 1.4.1