diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-08-20 12:28:05 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-08-20 12:28:05 +0000 |
commit | 1229d05c19453a344d696f3fc95fad4115b075b5 (patch) | |
tree | 139bdf537c448ad5518a27946ce2ce7e42b29619 /Src | |
parent | 4220133567baadc04b46d80803e382a7f87a42f3 (diff) | |
download | zsh-1229d05c19453a344d696f3fc95fad4115b075b5.tar.gz zsh-1229d05c19453a344d696f3fc95fad4115b075b5.tar.xz zsh-1229d05c19453a344d696f3fc95fad4115b075b5.zip |
fix default completion module loading, use compctl if it hasn't been loaded already and no completion widgets have been defined (17567)
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/zle_main.c | 1 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 2 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 11 |
3 files changed, 13 insertions, 1 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 1ec0171bb..e1429a0d0 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1355,6 +1355,7 @@ setup_(Module m) varedarg = NULL; incompfunc = incompctlfunc = hascompmod = 0; + hascompwidgets = 0; clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *)); diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 2946ea209..7d6c5103e 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -601,6 +601,8 @@ bin_zle_complete(char *name, char **args, char *ops, char func) zwarnnam(name, "widget name `%s' is protected", args[0], 0); return 1; } + hascompwidgets++; + return 0; } diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 5d7e4cdd2..60cbb8a71 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -146,6 +146,11 @@ mod_export int cfret; /**/ mod_export int comprecursive; +/* != 0 if there are any defined completion widgets. */ + +/**/ +int hascompwidgets; + /* Find out if we have to insert a tab (instead of trying to complete). */ /**/ @@ -557,7 +562,11 @@ docomplete(int lst) if (undoing) setlastline(); - if (!module_loaded("zsh/complete")) + /* We the C-code's point of view, we can only use compctl as a default + * type of completion. Load it if it hasn't been loaded already and + * no completion widgets are defined. */ + + if (!module_loaded("zsh/compctl") && !hascompwidgets) load_module("zsh/compctl"); if (runhookdef(BEFORECOMPLETEHOOK, (void *) &lst)) { |