summaryrefslogtreecommitdiff
path: root/Src/Zle/zle_misc.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-04-22 15:08:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-04-22 15:08:04 +0000
commit2cec7aae44579d9d8ca8c7e728f9eb6e2840d72f (patch)
treea1725b9e9fba5cc1959b029167bd8137183cf092 /Src/Zle/zle_misc.c
parenta58d02fd2e11f8453b912859b2f774b6cadace4c (diff)
downloadzsh-2cec7aae44579d9d8ca8c7e728f9eb6e2840d72f.tar.gz
zsh-2cec7aae44579d9d8ca8c7e728f9eb6e2840d72f.zip
24861 (with tweaks): logic to use alternative wcwidth() if needed;
slightly improve test for overwriting with combining characters.
Diffstat (limited to 'Src/Zle/zle_misc.c')
-rw-r--r--Src/Zle/zle_misc.c10
1 files changed, 8 insertions, 2 deletions
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