From b148a56869958ee691c57ddaf633a8a4e038b3dc Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 6 Apr 2009 09:06:35 +0000 Subject: 26806 (doc tweaked): Add CORRECT_IGNORE variable --- Src/utils.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Src') 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) -- cgit 1.4.1