* Re: Bug#357934: zsh: '-', '.' etc. shouldn't be recognized as word chars
[not found] <20060320112411.GA7879@implementation.labri.fr>
@ 2006-03-20 14:37 ` Clint Adams
[not found] ` <20060320144126.GO4621@implementation.labri.fr>
0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2006-03-20 14:37 UTC (permalink / raw)
To: zsh-workers; +Cc: Samuel Thibault, 357934
> Hi,
>
> Vi mode now recognizes '-', '.', as word chars:
>
> $ a-b
>
> When pressing 'w' with cursor on 'a', the cursor skips the whole "a-b"
> string. But it should rather stop at '-'.
>
> One can override this by defining WORDCHARS to letters, but the default
> should really be what documentation says:
>
> « word characters are alphanumeric characters »
> (which include all characters for which libc's isalnum() returns true).
>
> This wasn't the case in version 4.3.1-1. The fix for #357313 probably
> needs fixing.
This will do alphanumerics and underscores. I no longer have any idea
what the correct behavior is supposed to be.
Index: Src/Zle/zle.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle.h,v
retrieving revision 1.27
diff -u -r1.27 zle.h
--- Src/Zle/zle.h 9 Feb 2006 22:12:54 -0000 1.27
+++ Src/Zle/zle.h 20 Mar 2006 14:27:14 -0000
@@ -72,6 +72,7 @@
/* 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 @@
/* 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
Index: Src/Zle/zle_word.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_word.c,v
retrieving revision 1.8
diff -u -r1.8 zle_word.c
--- Src/Zle/zle_word.c 17 Mar 2006 23:45:44 -0000 1.8
+++ Src/Zle/zle_word.c 20 Mar 2006 14:27:14 -0000
@@ -54,7 +54,7 @@
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 @@
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 @@
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 @@
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 @@
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug#357934: zsh: '-', '.' etc. shouldn't be recognized as word chars
[not found] ` <20060320144126.GO4621@implementation.labri.fr>
@ 2006-03-20 15:20 ` Clint Adams
0 siblings, 0 replies; 2+ messages in thread
From: Clint Adams @ 2006-03-20 15:20 UTC (permalink / raw)
To: Samuel Thibault, 357934; +Cc: zsh-workers
> Mmm, bug here :)
How embarrassing.
Index: Src/Zle/zle.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle.h,v
retrieving revision 1.28
diff -u -r1.28 zle.h
--- Src/Zle/zle.h 20 Mar 2006 14:40:43 -0000 1.28
+++ Src/Zle/zle.h 20 Mar 2006 15:20:20 -0000
@@ -138,7 +138,7 @@
/* Functions that operate on ZLE_CHAR_T. */
#define ZC_ialpha ialpha
-#define ZC_ialpha ialnum
+#define ZC_ialnum ialnum
#define ZC_iblank iblank
#define ZC_icntrl icntrl
#define ZC_idigit idigit
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-20 15:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20060320112411.GA7879@implementation.labri.fr>
2006-03-20 14:37 ` Bug#357934: zsh: '-', '.' etc. shouldn't be recognized as word chars Clint Adams
[not found] ` <20060320144126.GO4621@implementation.labri.fr>
2006-03-20 15:20 ` 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).