diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | Completion/Base/Completer/_expand_alias | 5 | ||||
-rw-r--r-- | Completion/Base/Core/_description | 16 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 11 | ||||
-rw-r--r-- | Completion/Unix/Command/_rm | 10 | ||||
-rw-r--r-- | Completion/X/Command/_x_utils | 2 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 2 |
7 files changed, 44 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog index d4329ad4e..201f27399 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,25 @@ Functions/Zle/.distfiles, Functions/Zle/expand-absolute-path: new expand-absolute-path ZLE widget. +2014-02-26 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * Jun T: Completion/Base/Core/_description, + Completion/Unix/Command/_rm: improved quoting for ignore-line + style. + +2014-02-24 Oliver Kiddle <opk@zsh.org> + + * unposted: Doc/Zsh/compsys.yo: fix typo + + * unposted: Completion/X/Command/_x_utils: duplicate local + statement was printing variable value + + * users/18498: Completion/Base/Completer/_expand_alias: observe + add-space style in _expand_alias so suffix can be disabled + + * users/18485: Completion/Unix/Command/_git: add .. as an + auto-removable suffix in git revision ranges + 2014-02-24 Peter Stephenson <p.stephenson@samsung.com> * Hong Xu: 32492: Completion/Unix/Command/_npm: fix outdated diff --git a/Completion/Base/Completer/_expand_alias b/Completion/Base/Completer/_expand_alias index 8848e668d..8240e4162 100644 --- a/Completion/Base/Completer/_expand_alias +++ b/Completion/Base/Completer/_expand_alias @@ -1,7 +1,7 @@ #compdef -K _expand_alias complete-word \C-xa local word expl tmp pre sel what -local -a tmpa +local -a tmpa suf eval "$_comp_setup" @@ -58,7 +58,8 @@ if [[ -n $tmp ]]; then tmp="\\$tmp" fi fi - $pre _wanted aliases expl alias compadd -UQ -- ${tmp%%[[:blank:]]##} + zstyle -T ":completion:${curcontext}:" add-space || suf=( -S '' ) + $pre _wanted aliases expl alias compadd -UQ "$suf[@]" -- ${tmp%%[[:blank:]]##} elif (( $#pre )) && zstyle -t ":completion:${curcontext}:" complete; then $pre _aliases -s "$sel" -S '' else diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description index 3d993271c..304c747a6 100644 --- a/Completion/Base/Core/_description +++ b/Completion/Base/Core/_description @@ -47,17 +47,19 @@ if [[ -z "$_comp_no_ignore" ]]; then zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore || _comp_ignore=() - zstyle -s ":completion:${curcontext}:$1" ignore-line hidden && + if zstyle -s ":completion:${curcontext}:$1" ignore-line hidden; then + local -a qwords + qwords=( ${words//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} ) case "$hidden" in - true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" ${(q)"${words[@]}"} );; - current) _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );; + true|yes|on|1) _comp_ignore+=( $qwords );; + current) _comp_ignore+=( $qwords[CURRENT] );; current-shown) [[ "$compstate[old_list]" = *shown* ]] && - _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );; - other) _comp_ignore=( "$_comp_ignore[@]" - "${(@q)words[1,CURRENT-1]}" - "${(@q)words[CURRENT+1,-1]}" );; + _comp_ignore+=( $qwords[CURRENT] );; + other) _comp_ignore+=( $qwords[1,CURRENT-1] + $qwords[CURRENT+1,-1] );; esac + fi # Ensure the ignore option is first so we can override it # for fake-always. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a2cbf74d0..b082bb050 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5526,9 +5526,12 @@ __git_remote_branch_names_noprefix () { __git_commits () { # TODO: deal with things that __git_heads and __git_tags has in common (i.e., # if both exists, they need to be completed to heads/x and tags/x. + local -a sopts ropt + zparseopts -E -a sopts S: r:=ropt R: q + sopts+=( $ropt:q ) _alternative \ - 'heads::__git_heads' \ - 'commit-tags::__git_commit_tags' \ + "heads::__git_heads $sopts" \ + "commit-tags::__git_commit_tags $sopts" \ 'commit-objects::__git_commit_objects' } @@ -5595,10 +5598,12 @@ __git_commits2 () { (( $+functions[__git_commit_ranges] )) || __git_commit_ranges () { + local -a suf if compset -P '*..(.|)'; then __git_commits $* else - __git_commits $* -qS .. + compset -S '..*' || suf=( -qS .. -r '.@~ ^:' ) + __git_commits $* $suf fi } diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index 20f44afc5..1f156c481 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -32,13 +32,9 @@ _arguments -C $opts \ case $state in (file) - declare -a ignored - ignored=() - ((CURRENT > 1)) && - ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) - ((CURRENT < $#line)) && - ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) - _files -F ignored && ret=0 + line[CURRENT]=() + line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} ) + _files -F line && ret=0 ;; esac diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils index 0ff0cf268..9448fd3df 100644 --- a/Completion/X/Command/_x_utils +++ b/Completion/X/Command/_x_utils @@ -69,7 +69,7 @@ xev) '-rv' ;; xhost) - local expl type ret=1 tmp match + local type tmp match if compset -P '-'; then tmp=(${(f)"$(xhost)"}) diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 6f1917d36..c304461e2 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -2344,7 +2344,7 @@ This is used by the tt(_history) completer and the tt(_history_complete_word) bindable command to decide which words should be completed. -If it is a singe number, only the last var(N) words from the history +If it is a single number, only the last var(N) words from the history will be completed. If it is a range of the form `var(max)tt(:)var(slice)', |