From 6f2112f23a4838fd1c52efd16c844142f5407394 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Fri, 27 Apr 2001 09:12:33 +0000 Subject: try to improve testing for suffix style in _expand; make _path_files fail to complete words like ........ (14133) --- ChangeLog | 7 +++++++ Completion/Base/Completer/_expand | 7 ++++++- Completion/Unix/Type/_path_files | 2 +- Doc/Zsh/compsys.yo | 16 +++------------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fc82d5fe..89f75dbe4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-04-27 Sven Wischnowsky + + * 14133: Completion/Base/Completer/_expand, + Completion/Unix/Type/_path_files, Doc/Zsh/compsys.yo: try to + improve testing for suffix style in _expand; make _path_files + fail to complete words like ........ + 2001-04-26 Bart Schaefer * 14129: Completion/Base/Completer/_approximate: Use a trap to diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand index 8fcedea96..f3da119e1 100644 --- a/Completion/Base/Completer/_expand +++ b/Completion/Base/Completer/_expand @@ -28,8 +28,13 @@ fi ( "$word" = *\$[a-zA-Z0-9_]## && $+parameters[${word##*\$}] -eq 0 ) ]] && return 1 +### I'm not sure about the pattern to use in the following test. +# It once was: +# [[ "$word" = (\~*/|\$(|[=~#^+])[a-zA-Z0-9_\[\]]##[^a-zA-Z0-9_\[\]]|\$\{*\}?)[^\$\{\}\(\)\<\>?^*#~]# ]] && + zstyle -T ":completion:${curcontext}:" suffix && - [[ "$word" = (\~*/|\$(|[=~#^+])[a-zA-Z0-9_\[\]]##[^a-zA-Z0-9_\[\]]|\$\{*\}?)[^\$\{\}\(\)\<\>?^*#~]# ]] && + [[ "$word" = (\~*/|*\$(|[=~#^+])[a-zA-Z0-9_\[\]]##[^a-zA-Z0-9_\[\]]|*\$\{*\}?) && + "${(e)word}" != *[][^~*?\<\>\{\}\|]* ]] && return 1 zstyle -t ":completion:${curcontext}:" accept-exact || diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index ffaf0d77f..6a30cf2b8 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -190,7 +190,7 @@ eorig="$orig" # Now let's have a closer look at the string to complete. -if [[ "$pre" = *(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' ]]; then +if [[ "$pre" = [^][*?#^\|\<\>]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' ]]; then # If there is a parameter expansion in the word from the line, we try # to complete the beast by expanding the prefix and completing anything diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 040429d5d..ba7c148c7 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1949,7 +1949,7 @@ The default is `true'. kindex(suffix, completion style) item(tt(suffix))( This is used by the tt(_expand) completer if the word starts with a -tilde or parameter expansion. If it is set to `true', the word will +tilde or contains a parameter expansion. If it is set to `true', the word will only be expanded if it doesn't have a suffix, i.e. if it is something like `tt(~foo)' or `tt($foo)', but not if it is `tt(~foo/)' or `tt($foo/bar)', unless that suffix itself contains characters eligible @@ -2001,18 +2001,8 @@ of the tag in the context names used to look up styles. If the var(label) starts with a hyphen, the var(tag) is prepended to the var(label) to form the name used for lookup. This can be used to make the completion system try a certain tag more than once, -supplying different style settings for each attempt. For example, - -example(zstyle ':completion:*:*:-command-:*' \ - tag-order 'functions:-non-comp' -zstyle ':completion:*:functions-non-comp' \ - ignored-patterns '_*') - -This makes completion in command position first try only names of shell -functions that don't match the pattern `tt(_*)'. If that generates no -matches, the default of trying all the other things that can be -completed in command position is used, including the names of all -shell functions. +supplying different style settings for each attempt, see below for an +example. The var(label) may optionally be followed by a second colon and a description. This description will then be used for the `tt(%d)' in -- cgit 1.4.1