summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-11-19 07:55:42 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-11-24 08:18:28 +0000
commitb3a88a53d379d6b59ccee468723a034f65fd757d (patch)
treeed71d19a6beb3575fd01f4987f0b4fb112c85076
parentc0f95d07e7be34a30047a8202aeb01b864600151 (diff)
downloadzsh-b3a88a53d379d6b59ccee468723a034f65fd757d.tar.gz
zsh-b3a88a53d379d6b59ccee468723a034f65fd757d.tar.xz
zsh-b3a88a53d379d6b59ccee468723a034f65fd757d.zip
39982: $SPROMPT: Don't accept a spelling correction at space/tab.
The patch also downscopes a couple of local variables, with no
functional change.
-rw-r--r--ChangeLog5
-rw-r--r--README5
-rw-r--r--Src/utils.c8
3 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 58ed68801..d6d241534 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-24  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 39982: README, Src/utils.c: $SPROMPT: Don't accept a spelling
+	correction at space/tab.
+
 2016-11-23  Bart Schaefer  <schaefer@zsh.org>
 
 	* unposted: Src/Zle/zle_main.c: clear ERRFLAG_ERROR before
diff --git a/README b/README
index 855e76492..568f1ad6c 100644
--- a/README
+++ b/README
@@ -116,6 +116,11 @@ are output as "export" commands unless the parameter is also local, and
 other parameters not local to the scope are output with the "-g" option.
 Previously, only "typeset" commands were output, never using "-g".
 
+8) At spelling-correction prompt ($SPROMPT), where the choices offered are
+[nyae], previously <Enter> would be accepted to mean [N] and <Space> and
+<Tab> would be accepted to mean [Y].  Now <Space> and <Tab> are invalid
+choices: typing either of them remains at the prompt.
+
 Incompatibilities between 5.0.8 and 5.2
 ---------------------------------------
 
diff --git a/Src/utils.c b/Src/utils.c
index 7bbd5887f..7f3ddad40 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2944,9 +2944,7 @@ mod_export void
 spckword(char **s, int hist, int cmd, int ask)
 {
     char *t, *correct_ignore;
-    int x;
     char ic = '\0';
-    int ne;
     int preflen = 0;
     int autocd = cmd && isset(AUTOCD) && strcmp(*s, ".") && strcmp(*s, "..");
 
@@ -3015,6 +3013,7 @@ spckword(char **s, int hist, int cmd, int ask)
     } else {
 	guess = *s;
 	if (*guess == Tilde || *guess == String) {
+	    int ne;
 	    ic = *guess;
 	    if (!*++t)
 		return;
@@ -3059,6 +3058,7 @@ spckword(char **s, int hist, int cmd, int ask)
     if (errflag)
 	return;
     if (best && (int)strlen(best) > 1 && strcmp(best, guess)) {
+	int x;
 	if (ic) {
 	    char *u;
 	    if (preflen) {
@@ -3088,14 +3088,14 @@ spckword(char **s, int hist, int cmd, int ask)
 		free(pptbuf);
 		fflush(shout);
 		zbeep();
-		x = getquery("nyae \t", 0);
+		x = getquery("nyae", 0);
 		if (cmd && x == 'n')
 		    pathchecked = path;
 	    } else
 		x = 'n';
 	} else
 	    x = 'y';
-	if (x == 'y' || x == ' ' || x == '\t') {
+	if (x == 'y') {
 	    *s = dupstring(best);
 	    if (hist)
 		hwrep(best);