about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_word.c26
2 files changed, 17 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index dde7c5e8d..f27275681 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
 	* 22364: Src/Builtins/rlimits.awk: add 'nice' and
 	'rt_priority' rlimits (NICE and RTPRIO).
 
+	* 22366: Src/Zle/zle_word.c: better handling for
+	multibyte-character-containing words in vi widgets.
+
 2006-03-16  Clint Adams  <clint@zsh.org>
 
 	* 22349: Completion/X/Command/_nautilus: completion for
diff --git a/Src/Zle/zle_word.c b/Src/Zle/zle_word.c
index b2db659cd..4ffaba21a 100644
--- a/Src/Zle/zle_word.c
+++ b/Src/Zle/zle_word.c
@@ -54,6 +54,8 @@ forwardword(char **args)
     return 0;
 }
 
+#define Z_vident(X) (ZC_iword(X) || (ZWC('_') == X))
+
 /**/
 int
 viforwardword(char **args)
@@ -68,11 +70,11 @@ viforwardword(char **args)
 	return ret;
     }
     while (n--) {
-	if (iident(zleline[zlecs]))
-	    while (zlecs != zlell && iident(zleline[zlecs]))
+	if (Z_vident(zleline[zlecs]))
+	    while (zlecs != zlell && Z_vident(zleline[zlecs]))
 		zlecs++;
 	else
-	    while (zlecs != zlell && !iident(zleline[zlecs]) && !ZC_iblank(zleline[zlecs]))
+	    while (zlecs != zlell && !Z_vident(zleline[zlecs]) && !ZC_iblank(zleline[zlecs]))
 		zlecs++;
 	if (wordflag && !n)
 	    return 0;
@@ -166,11 +168,11 @@ viforwardwordend(char **args)
 	if (ZC_iblank(zleline[zlecs + 1]))
 	    while (zlecs != zlell && ZC_iblank(zleline[zlecs + 1]))
 		zlecs++;
-	if (iident(zleline[zlecs + 1]))
-	    while (zlecs != zlell && iident(zleline[zlecs + 1]))
+	if (Z_vident(zleline[zlecs + 1]))
+	    while (zlecs != zlell && Z_vident(zleline[zlecs + 1]))
 		zlecs++;
 	else
-	    while (zlecs != zlell && !iident(zleline[zlecs + 1]) && !ZC_iblank(zleline[zlecs + 1]))
+	    while (zlecs != zlell && !Z_vident(zleline[zlecs + 1]) && !ZC_iblank(zleline[zlecs + 1]))
 		zlecs++;
     }
     if (zlecs != zlell && virangeflag)
@@ -216,11 +218,11 @@ vibackwardword(char **args)
     while (n--) {
 	while (zlecs && ZC_iblank(zleline[zlecs - 1]))
 	    zlecs--;
-	if (iident(zleline[zlecs - 1]))
-	    while (zlecs && iident(zleline[zlecs - 1]))
+	if (Z_vident(zleline[zlecs - 1]))
+	    while (zlecs && Z_vident(zleline[zlecs - 1]))
 		zlecs--;
 	else
-	    while (zlecs && !iident(zleline[zlecs - 1]) && !ZC_iblank(zleline[zlecs - 1]))
+	    while (zlecs && !Z_vident(zleline[zlecs - 1]) && !ZC_iblank(zleline[zlecs - 1]))
 		zlecs--;
     }
     return 0;
@@ -306,11 +308,11 @@ vibackwardkillword(UNUSED(char **args))
     while (n--) {
 	while ((x > lim) && ZC_iblank(zleline[x - 1]))
 	    x--;
-	if (iident(zleline[x - 1]))
-	    while ((x > lim) && iident(zleline[x - 1]))
+	if (Z_vident(zleline[x - 1]))
+	    while ((x > lim) && Z_vident(zleline[x - 1]))
 		x--;
 	else
-	    while ((x > lim) && !iident(zleline[x - 1]) && !ZC_iblank(zleline[x - 1]))
+	    while ((x > lim) && !Z_vident(zleline[x - 1]) && !ZC_iblank(zleline[x - 1]))
 		x--;
     }
     backkill(zlecs - x, 1);