diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Completion/Base/Core/_description | 14 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 22 |
3 files changed, 35 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index 3f63516be..e1b218f51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-07-21 Peter Stephenson <pws@csr.com> + + * 18859: Completion/Base/Core/_description, Doc/Zsh/compsys.yo: + Allow sort style to be set to false to turn off sorting when + on by default. + 2003-07-21 Doug Kearns <djkea2@mugca.its.monash.edu.au> * 18872: Completion/Unix/Command/_java: update javac completion for diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description index 41f4f2483..573bfbc3d 100644 --- a/Completion/Base/Core/_description +++ b/Completion/Base/Core/_description @@ -1,6 +1,6 @@ #autoload -local name gropt nopt xopt format gname hidden hide match opts tag +local name gropt nopt xopt format gname hidden hide match opts tag sort opts=() @@ -31,6 +31,18 @@ zstyle -s ":completion:${curcontext}:$1" matcher match && opts=($opts -M "$match") [[ -n "$_matcher" ]] && opts=($opts -M "$_matcher") +# Use sort style, but ignore `menu' value to help _expand. +# Also don't override explicit use of -V. +if { zstyle -s ":completion:${curcontext}:$1" sort sort || + zstyle -s ":completion:${curcontext}:" sort sort; } && + [[ "$gropt" = -J && $sort != menu ]]; then + if [[ "$sort" = (yes|true|1|on) ]]; then + gropt=(-J) + else + gropt=(-V) + fi +fi + if [[ -z "$_comp_no_ignore" ]]; then zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore || _comp_ignore=() diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index e48a057f7..6b77fb8f8 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -2162,12 +2162,22 @@ is started, making it easy to select either of them. ) kindex(sort, completion style) item(tt(sort))( -If set to `true', completing words from the command -history sorts the words alphabetically instead of -keeping them in the order in which they appear in the history (from -youngest to oldest). - -This is also used by the tt(_expand) completer. If it is set to +Many completion widgets call tt(_description) at some point which +decides whether the matches are added sorted or unsorted (often +indirectly via tt(_wanted) or tt(_requested)). This style can be set +explicitly to one of the usual true or false values as an override. +If it is not set for the context, the standard behaviour of the +calling widget is used. + +The style is tested first against the full context including the tag, and +if that fails to produce a value against the context without the tag. + +If the calling widget explicitly requests unsorted matches, this is usually +honoured. However, the default (unsorted) behaviour of completion +for the command history may be overridden by setting the style to +tt(true). + +In the tt(_expand) completer, if it is set to `true', the expansions generated will always be sorted. If it is set to `tt(menu)', then the expansions are only sorted when they are offered as single strings but not in the string containing all possible |