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

PATCH: fix bug with Ctrl-^ handling



My normal editor allows Ctrl-6 and Shift-Ctrl-6 to be used for changing the case of the current selection. Sadly my terminal won't distinguish between the two keystrokes but I thought I'd bind it to uppercase the current word in zsh anyway. This revealed a bug in getkeystring():

in 3.1.6-dev-19:
bindkey '^^' capitalise-word
bindkey: cannot bind to an empty key sequence

in Bart's preliminary 3.0.8 I don't get an error message but the key continues to do nothing.

The problem was that in getkeystring() both '^'s are picked up and taken to set the variable control so the bindkey command works as if I had used just '^' as the key parameter. The following small patch fixes it. I have included patches for both 3.1.6 and 3.0.8 so you may need to separate them first or something.

Oliver Kiddle

--- zsh-3.1.6-dev-19/Src/utils.c.bak	Thu Mar  9 15:03:36 2000
+++ zsh-3.1.6-dev-19/Src/utils.c	Thu Mar  9 15:28:24 2000
@@ -3198,7 +3198,7 @@
 	} else if (fromwhere == 4 && *s == Snull) {
 	    for (u = t; (*u++ = *s++););
 	    return t + 1;
-	} else if (*s == '^' &&
+	} else if (*s == '^' && !control &&
 		   (fromwhere == 2 || fromwhere == 5 || fromwhere == 6)) {
 	    control = 1;
 	    continue;
--- zsh-3.0.8/Src/zle_main.c.bak	Thu Mar  9 15:25:39 2000
+++ zsh-3.0.8/Src/zle_main.c	Thu Mar  9 15:26:23 2000
@@ -845,7 +845,7 @@
 		}
 		break;
 	    }
-	} else if (*s == '^' && fromwhere == 2) {
+	} else if (*s == '^' && !control && fromwhere == 2) {
 	    control = 1;
 	    continue;
 	} else if (*s == Meta)



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