From 079540cc7859ad73c0ccfb6db8ad3aa138037925 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 20 Feb 2014 01:11:28 +0100 Subject: users/18485: add .. as an auto-removable suffix in git revision ranges --- Completion/Unix/Command/_git | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Completion') 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 } -- cgit 1.4.1 From 7c314132789aa2b7a571890eca06d3f1e22d0f0e Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 20 Feb 2014 14:54:58 +0100 Subject: users/18498: observe add-space style in _expand_alias so suffix can be disabled --- ChangeLog | 3 +++ Completion/Base/Completer/_expand_alias | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion') diff --git a/ChangeLog b/ChangeLog index f9e7f1690..27b5e9a80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-02-24 Oliver Kiddle + * 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 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 -- cgit 1.4.1 From 39717411aeb4f72b772d97eeff3f9c1ecf48aae6 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 25 Feb 2014 09:14:21 +0100 Subject: unposted: duplicate local statement was printing variable value --- ChangeLog | 3 +++ Completion/X/Command/_x_utils | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion') diff --git a/ChangeLog b/ChangeLog index 27b5e9a80..5f73fdb57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-02-24 Oliver Kiddle + * 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 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)"}) -- cgit 1.4.1 From 7d7242405a82332716b5fdba68f32ecabf6349be Mon Sep 17 00:00:00 2001 From: Jun T Date: Thu, 27 Feb 2014 01:32:32 +0900 Subject: 32435: improved quoting for ignore-line completion style --- ChangeLog | 6 ++++++ Completion/Base/Core/_description | 16 +++++++++------- Completion/Unix/Command/_rm | 10 +++------- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'Completion') diff --git a/ChangeLog b/ChangeLog index 18c866aa2..e36b1b770 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-02-26 Peter Stephenson + + * Jun T: Completion/Base/Core/_description, + Completion/Unix/Command/_rm: improved quoting for ignore-line + style. + 2014-02-24 Oliver Kiddle * unposted: Doc/Zsh/compsys.yo: fix typo 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/_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 -- cgit 1.4.1