From 779ad93490f03e0759c065618a3267d2e6f07b84 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Thu, 30 Jan 2014 08:25:06 -0800 Subject: 32322: display a message when completion is interrupted from the keyboard --- Completion/Base/Core/_main_complete | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Completion/Base/Core') diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index d6831b81b..8dd781dbb 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -126,6 +126,11 @@ fi _completer_num=1 +# We assume localtraps to be in effect here ... +integer SECONDS=0 +trap 'zle -M "Killed by signal in ${funcstack[0]} after ${SECONDS}s"; + zle -R; return 130' INT QUIT + # Call the pre-functions. funcs=( "$compprefuncs[@]" ) -- cgit v1.2.3 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/Base/Core') 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 v1.2.3 From 1f290a3e8277347a782a7766948aab47c10120c8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 3 Mar 2014 12:08:45 +0100 Subject: 32439: add new show-ambiguity style --- ChangeLog | 3 +++ Completion/Base/Core/_main_complete | 8 ++++++++ Doc/Zsh/compsys.yo | 9 +++++++++ 3 files changed, 20 insertions(+) (limited to 'Completion/Base/Core') diff --git a/ChangeLog b/ChangeLog index d35f5b049..cf4e223d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-03-03 Oliver Kiddle + * 32439 (with Yuri D'Elia): Completion/Base/Core/_main_complete: + add new show-ambiguity style + * 32436: Src/Zle/complist.c: allow = to be used in ZLS_COLORS patterns if it is quoted or inside parentheses diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index 8dd781dbb..e881ea6a1 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -334,6 +334,14 @@ elif [[ nm -eq 0 && -z "$_comp_mesg" && compadd -x "$mesg" fi +if zstyle -s ":completion:${curcontext}:" show-ambiguity tmp; then + local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]} + local toquote='[=\(\)\|~^?*[\]#<>]' + [[ $tmp = (yes|true|on) ]] && tmp=4 + [[ -n $prefix ]] && + _comp_colors+=( "=(#i)${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${MATCH/$~toquote/\\$MATCH}|)}${prefix[-1]//(#m)$~toquote/\\$MATCH}(#b)(?|)*==$tmp" ) +fi + [[ "$_comp_force_list" = always || ( "$_comp_force_list" = ?* && nm -ge _comp_force_list ) ]] && compstate[list]="${compstate[list]//messages} force" diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index c304461e2..5a5e61996 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -2440,6 +2440,15 @@ completing words for the dict command. It allows words from different dictionary databases to be added separately. The default for this style is `false'. ) +kindex(show-ambiguity, completion style) +item(tt(show-ambiguity))( +If the tt(zsh/complist) module is loaded, this style can be used to +highlight the first ambiguous character in completion lists. The +value is either a color indication such as those supported by the +tt(list-colors) style or, with a value of tt(true), a default of +underlining is selected. The highlighting is only applied if the +completion display strings correspond to the actual matches. +) kindex(show-completer, completion style) item(tt(show-completer))( Tested whenever a new completer is tried. If it is true, the completion -- cgit v1.2.3