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

Re: Problems with vi-goto-mark and vi-set-mark



"Felix Rosencrantz" wrote:
> I've recently been trying to use viins/vicmd mode.  I've hit a small
> problem with the vi-set-mark and vi-goto-mark, they seem to be broken
> in the latest version of zsh.  Though it looks like it was working in
> 4.2.5.

Yes, I don't use vi mode so don't notice this sort of thing.  We could
do with someone writing interactive tests for zle commands.  We could
also do with someone to look after vi mode.  We could do with people
doing a lot of things.

The change is that getchar() used not to set the last character, which
was done at a higher level, but the replacements which support multibyte
do (even if multibyte mode isn't compiled in).  This means the character
read is always treated as if it was the same as the last character.

I think the following fixes it, but I'm not sure what the feature is in
vi-goto-mark that has the special behaviour if the last character is
repeated.  If you know and can test it, please do.

Index: Src/Zle/zle.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle.h,v
retrieving revision 1.34
diff -u -r1.34 zle.h
--- Src/Zle/zle.h	3 Dec 2006 21:07:18 -0000	1.34
+++ Src/Zle/zle.h	15 Apr 2007 19:22:16 -0000
@@ -72,6 +72,7 @@
 #define ZC_toupper towupper
 
 #define LASTFULLCHAR	lastchar_wide
+#define LASTFULLCHAR_T  ZLE_INT_T
 
 #else  /* Not MULTIBYTE_SUPPORT: old single-byte code */
 
@@ -130,6 +131,7 @@
 #define ZC_toupper tuupper
 
 #define LASTFULLCHAR	lastchar
+#define LASTFULLCHAR_T	int
 
 #endif
 
Index: Src/Zle/zle_move.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_move.c,v
retrieving revision 1.8
diff -u -r1.8 zle_move.c
--- Src/Zle/zle_move.c	1 Nov 2005 02:50:29 -0000	1.8
+++ Src/Zle/zle_move.c	15 Apr 2007 19:22:16 -0000
@@ -484,9 +484,10 @@
 vigotomark(UNUSED(char **args))
 {
     ZLE_INT_T ch;
+    LASTFULLCHAR_T lfc = LASTFULLCHAR;
 
     ch = getfullchar(0);
-    if (ch == LASTFULLCHAR)
+    if (ch == lfc)
 	ch = 26;
     else {
 	if (ch < ZWC('a') || ch > ZWC('z'))

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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