about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2006-03-20 14:40:36 +0000
committerClint Adams <clint@users.sourceforge.net>2006-03-20 14:40:36 +0000
commit8294310202fdc2204d4175daa60aa3bcf4c86b54 (patch)
treea0128ac4d7ce0a2c7f1fb787f176c1b53bc1b13d
parent40df7069cb3f0bcac939eab2337511a5ac5ef510 (diff)
downloadzsh-8294310202fdc2204d4175daa60aa3bcf4c86b54.tar.gz
zsh-8294310202fdc2204d4175daa60aa3bcf4c86b54.tar.xz
zsh-8294310202fdc2204d4175daa60aa3bcf4c86b54.zip
22371: use only alphanumerics and underscores as word characters with vi bindings.
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/zle.h2
-rw-r--r--Src/Zle/zle_word.c26
3 files changed, 21 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index dfa3b831e..7d1270daf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-20  Clint Adams  <clint@zsh.org>
+
+	* 22371: Src/Zle/zle.h, Src/Zle/zle_word.c: use
+	only alphanumerics and underscores as word characters
+	with vi bindings.
+
 2006-03-20  Peter Stephenson  <pws@csr.com>
 
 	* 22360, 22365: Makefile.in, README, Config/installfns.sh,
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 055b8bac4..924006adc 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -72,6 +72,7 @@ typedef wint_t   ZLE_INT_T;
 
 /* Functions that operate on ZLE_CHAR_T. */
 #define ZC_ialpha iswalpha
+#define ZC_ialnum iswalnum
 #define ZC_iblank wcsiblank
 #define ZC_icntrl iswcntrl
 #define ZC_idigit iswdigit
@@ -137,6 +138,7 @@ static inline int ZS_strncmp(ZLE_STRING_T s1, ZLE_STRING_T s2, size_t l)
 
 /* Functions that operate on ZLE_CHAR_T. */
 #define ZC_ialpha ialpha
+#define ZC_ialpha ialnum
 #define ZC_iblank iblank
 #define ZC_icntrl icntrl
 #define ZC_idigit idigit
diff --git a/Src/Zle/zle_word.c b/Src/Zle/zle_word.c
index 4ffaba21a..d24a0f7f7 100644
--- a/Src/Zle/zle_word.c
+++ b/Src/Zle/zle_word.c
@@ -54,7 +54,7 @@ forwardword(char **args)
     return 0;
 }
 
-#define Z_vident(X) (ZC_iword(X) || (ZWC('_') == X))
+#define Z_vialnum(X) (ZC_ialnum(X) || (ZWC('_') == X))
 
 /**/
 int
@@ -70,11 +70,11 @@ viforwardword(char **args)
 	return ret;
     }
     while (n--) {
-	if (Z_vident(zleline[zlecs]))
-	    while (zlecs != zlell && Z_vident(zleline[zlecs]))
+	if (Z_vialnum(zleline[zlecs]))
+	    while (zlecs != zlell && Z_vialnum(zleline[zlecs]))
 		zlecs++;
 	else
-	    while (zlecs != zlell && !Z_vident(zleline[zlecs]) && !ZC_iblank(zleline[zlecs]))
+	    while (zlecs != zlell && !Z_vialnum(zleline[zlecs]) && !ZC_iblank(zleline[zlecs]))
 		zlecs++;
 	if (wordflag && !n)
 	    return 0;
@@ -168,11 +168,11 @@ viforwardwordend(char **args)
 	if (ZC_iblank(zleline[zlecs + 1]))
 	    while (zlecs != zlell && ZC_iblank(zleline[zlecs + 1]))
 		zlecs++;
-	if (Z_vident(zleline[zlecs + 1]))
-	    while (zlecs != zlell && Z_vident(zleline[zlecs + 1]))
+	if (Z_vialnum(zleline[zlecs + 1]))
+	    while (zlecs != zlell && Z_vialnum(zleline[zlecs + 1]))
 		zlecs++;
 	else
-	    while (zlecs != zlell && !Z_vident(zleline[zlecs + 1]) && !ZC_iblank(zleline[zlecs + 1]))
+	    while (zlecs != zlell && !Z_vialnum(zleline[zlecs + 1]) && !ZC_iblank(zleline[zlecs + 1]))
 		zlecs++;
     }
     if (zlecs != zlell && virangeflag)
@@ -218,11 +218,11 @@ vibackwardword(char **args)
     while (n--) {
 	while (zlecs && ZC_iblank(zleline[zlecs - 1]))
 	    zlecs--;
-	if (Z_vident(zleline[zlecs - 1]))
-	    while (zlecs && Z_vident(zleline[zlecs - 1]))
+	if (Z_vialnum(zleline[zlecs - 1]))
+	    while (zlecs && Z_vialnum(zleline[zlecs - 1]))
 		zlecs--;
 	else
-	    while (zlecs && !Z_vident(zleline[zlecs - 1]) && !ZC_iblank(zleline[zlecs - 1]))
+	    while (zlecs && !Z_vialnum(zleline[zlecs - 1]) && !ZC_iblank(zleline[zlecs - 1]))
 		zlecs--;
     }
     return 0;
@@ -308,11 +308,11 @@ vibackwardkillword(UNUSED(char **args))
     while (n--) {
 	while ((x > lim) && ZC_iblank(zleline[x - 1]))
 	    x--;
-	if (Z_vident(zleline[x - 1]))
-	    while ((x > lim) && Z_vident(zleline[x - 1]))
+	if (Z_vialnum(zleline[x - 1]))
+	    while ((x > lim) && Z_vialnum(zleline[x - 1]))
 		x--;
 	else
-	    while ((x > lim) && !Z_vident(zleline[x - 1]) && !ZC_iblank(zleline[x - 1]))
+	    while ((x > lim) && !Z_vialnum(zleline[x - 1]) && !ZC_iblank(zleline[x - 1]))
 		x--;
     }
     backkill(zlecs - x, 1);