zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: vi{forward,backward}word in the multibyte world
@ 2006-03-17 23:43 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2006-03-17 23:43 UTC (permalink / raw)
  To: zsh-workers

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-17 23:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-17 23:43 PATCH: vi{forward,backward}word in the multibyte world Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).