about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/complist.c2
-rw-r--r--Src/Zle/zle_hist.c2
-rw-r--r--Src/Zle/zle_misc.c10
-rw-r--r--Src/Zle/zle_refresh.c10
-rw-r--r--Src/Zle/zle_tricky.c2
5 files changed, 16 insertions, 10 deletions
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 651a5103c..1543a1506 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1017,7 +1017,7 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
 	}
 	else
 #endif
-	    width = WCWIDTH(cchar);
+	    width = WCWIDTH_WINT(cchar);
 
 	if (doesc && cchar == ZWC('%')) {
 	    p += len;
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 5af482f9e..91d2d1016 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1045,6 +1045,7 @@ doisearch(char **args, int dir)
 		free(last_line);
 	    last_line = ztrdup(zt.text);
 
+	    sbuf[sbptr] = '\0';
 	    for (;;) {
 		char *t;
 
@@ -1076,7 +1077,6 @@ doisearch(char **args, int dir)
 		 * First search for a(nother) match within the
 		 * current line, unless we've been told to skip it.
 		 */
-		sbuf[sbptr] = '\0';
 		if (!skip_line && ((sbuf[0] == '^') ?
 				   (t = (zlinecmp(zt.text, sbuf + 1) < sens
 					 ? zt.text : NULL)) :
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
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index a9bc017f8..66cae9f97 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1222,7 +1222,7 @@ zrefresh(void)
 	    }
 	}
 #ifdef MULTIBYTE_SUPPORT
-	else if (iswprint(*t) && (width = wcwidth(*t)) > 0) {
+	else if (iswprint(*t) && (width = WCWIDTH(*t)) > 0) {
 	    int ichars;
 	    if (width > rpms.sen - rpms.s) {
 		int started = 0;
@@ -1397,7 +1397,7 @@ zrefresh(void)
 	for (; u < outputline + outll; u++) {
 #ifdef MULTIBYTE_SUPPORT
 	    if (iswprint(*u)) {
-		int width = wcwidth(*u);
+		int width = WCWIDTH(*u);
 		/* Handle wide characters as above */
 		if (width > rpms.sen - rpms.s) {
 		    do {
@@ -2144,7 +2144,7 @@ tc_rightcurs(int ct)
    characters occupying more than one column.  We could flag that
    this has happened (since it's not that common to have characters
    wider than one column), but for now it's easier not to use the
-   trick if we are using wcwidth() on the prompt.  It's not that
+   trick if we are using WCWIDTH() on the prompt.  It's not that
    common to be editing in the middle of the prompt anyway, I would
    think.
    */
@@ -2264,7 +2264,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
 	if (tmpline[t0] == ZWC('\t'))
 	    vsiz = (vsiz | 7) + 2;
 #ifdef MULTIBYTE_SUPPORT
-	else if (iswprint(tmpline[t0]) && (width = wcwidth(tmpline[t0]) > 0)) {
+	else if (iswprint(tmpline[t0]) && (width = WCWIDTH(tmpline[t0]) > 0)) {
 	    vsiz += width;
 	    if (isset(COMBININGCHARS) && IS_BASECHAR(tmpline[t0])) {
 		while (t0 < tmpll-1 && IS_COMBINING(tmpline[t0+1]))
@@ -2340,7 +2340,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
 	    vp++;
 #ifdef MULTIBYTE_SUPPORT
 	} else if (iswprint(tmpline[t0]) &&
-		   (width = wcwidth(tmpline[t0])) > 0) {
+		   (width = WCWIDTH(tmpline[t0])) > 0) {
 	    int ichars;
 	    if (isset(COMBININGCHARS) && IS_BASECHAR(tmpline[t0])) {
 		/*
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index d7c17676b..a6083764b 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2375,7 +2375,7 @@ printfmt(char *fmt, int n, int dopr, int doesc)
 		    }
 		} else
 		    p += clen;
-		cc += WCWIDTH(cchar);
+		cc += WCWIDTH_WINT(cchar);
 		if (dopr && !(cc % columns))
 			fputs(" \010", shout);
 	    }