Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: vi{forward,backward}word in the multibyte world



While the emacs bindings treat "accentué" as a single word,
the vi bindings seem to think it's two.

Can't use ZC_iident because it's ASCII-only, so I'm doing this
for lack of a better kludge:

Index: Src/Zle/zle_word.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_word.c,v
retrieving revision 1.7
diff -u -r1.7 zle_word.c
--- Src/Zle/zle_word.c	1 Nov 2005 02:50:31 -0000	1.7
+++ Src/Zle/zle_word.c	17 Mar 2006 23:38:56 -0000
@@ -54,6 +54,8 @@
     return 0;
 }
 
+#define Z_vident(X) (ZC_iword(X) || (ZWC('_') == X))
+
 /**/
 int
 viforwardword(char **args)
@@ -68,11 +70,11 @@
 	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 @@
 	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 @@
     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 @@
     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);



Messages sorted by: Reverse Date, Date, Thread, Author