about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-04-06 09:06:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-04-06 09:06:35 +0000
commitb148a56869958ee691c57ddaf633a8a4e038b3dc (patch)
tree37ce65ca06f1bdf29affa77eed297b4d939b7ac8 /Src
parent5f26203583ba19dc71a29b97a6fd35ad4da37375 (diff)
downloadzsh-b148a56869958ee691c57ddaf633a8a4e038b3dc.tar.gz
zsh-b148a56869958ee691c57ddaf633a8a4e038b3dc.tar.xz
zsh-b148a56869958ee691c57ddaf633a8a4e038b3dc.zip
26806 (doc tweaked): Add CORRECT_IGNORE variable
Diffstat (limited to 'Src')
-rw-r--r--Src/utils.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Src/utils.c b/Src/utils.c
index cf375821d..d259827a9 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2236,6 +2236,7 @@ getquery(char *valid_chars, int purge)
 
 static int d;
 static char *guess, *best;
+static Patprog spckpat;
 
 /**/
 static void
@@ -2243,6 +2244,9 @@ spscan(HashNode hn, UNUSED(int scanflags))
 {
     int nd;
 
+    if (spckpat && pattry(spckpat, hn->nam))
+	return;
+
     nd = spdist(hn->nam, guess, (int) strlen(guess) / 4 + 1);
     if (nd <= d) {
 	best = hn->nam;
@@ -2257,7 +2261,7 @@ spscan(HashNode hn, UNUSED(int scanflags))
 mod_export void
 spckword(char **s, int hist, int cmd, int ask)
 {
-    char *t;
+    char *t, *correct_ignore;
     int x;
     char ic = '\0';
     int ne;
@@ -2293,6 +2297,14 @@ spckword(char **s, int hist, int cmd, int ask)
 	    break;
     if (**s == Tilde && !*t)
 	return;
+
+    if ((correct_ignore = getsparam("CORRECT_IGNORE")) != NULL) {
+	tokenize(correct_ignore = dupstring(correct_ignore));
+	remnulargs(correct_ignore);
+	spckpat = patcompile(correct_ignore, 0, NULL);
+    } else
+	spckpat = NULL;
+
     if (**s == String && !*t) {
 	guess = *s + 1;
 	if (itype_end(guess, IIDENT, 1) == guess)