mirror of git://git.code.sf.net/p/zsh/code
26806 (doc tweaked): Add CORRECT_IGNORE variable
This commit is contained in:
parent
5f26203583
commit
b148a56869
|
@ -1,3 +1,8 @@
|
|||
2009-04-06 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 26806 (doc tweaked): Add CORRECT_IGNORE variable for pattern to
|
||||
be ignored by correction from internal hash tables.
|
||||
|
||||
2009-04-04 Clint Adams <clint@zsh.org>
|
||||
|
||||
* Simon Ruderich: 26800: Completion/Unix/Command/_git: fixes for "git add"
|
||||
|
@ -11513,5 +11518,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.4642 $
|
||||
* $Revision: 1.4643 $
|
||||
*****************************************************
|
||||
|
|
|
@ -1007,6 +1007,9 @@ Try to correct the spelling of commands.
|
|||
Note that, when the tt(HASH_LIST_ALL) option is not set or when some
|
||||
directories in the path are not readable, this may falsely report spelling
|
||||
errors the first time some commands are used.
|
||||
|
||||
The shell variable tt(CORRECT_IGNORE) may be set to a pattern to
|
||||
match words that will never be offered as corrections.
|
||||
)
|
||||
pindex(CORRECT_ALL)
|
||||
pindex(NO_CORRECT_ALL)
|
||||
|
|
|
@ -797,6 +797,17 @@ item(tt(COLUMNS) <S>)(
|
|||
The number of columns for this terminal session.
|
||||
Used for printing select lists and for the line editor.
|
||||
)
|
||||
vindex(CORRECT_IGNORE)
|
||||
item(tt(CORRECT_IGNORE))(
|
||||
If set, is treated as a pattern during spelling correction. Any
|
||||
potential correction that matches the pattern is ignored. For example,
|
||||
if the value is `tt(_*)' then completion functions (which, by
|
||||
convention, have names beginning with `tt(_)') will never be offered
|
||||
as spelling corrections. The pattern does not apply the correction
|
||||
of file names, as applied by the tt(CORRECT_ALL) option (so with the
|
||||
example just given files beginning with `tt(_)' in the current
|
||||
directory would still be completed).
|
||||
)
|
||||
vindex(DIRSTACKSIZE)
|
||||
item(tt(DIRSTACKSIZE))(
|
||||
The maximum size of the directory stack. If the
|
||||
|
|
14
Src/utils.c
14
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)
|
||||
|
|
Loading…
Reference in New Issue