Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: Time for an obscure completion question



Bart Schaefer wrote:

> ...
> 
> This second one still happens to me.  I've set a few more styles; what I
> get now is:
> 
> zagzig[72] cd *at/ba<TAB><TAB>
> zagzig[72] cd foodatthe/Bar/
> Completing `local directories', `directories in cdpath', or `corrections'
> 
> There are no completions beneath the verbose output there. 

That's a result of:

  zstyle ':completion:*' format 'Completing %d'

it makes it be used for warnings, too (warnings is what you get when
there are no matches).

> At this point
> if I hit TAB a third time, "foodatthe/Bar/" becomes " ".

And this is our frien _oldlist again, inserting the dummy match that
was added to display the warning.

I'm not completely happy with the test in _oldlist...

Bye
 Sven

Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.5
diff -u -r1.5 _main_complete
--- Completion/Core/_main_complete	2000/04/07 08:14:07	1.5
+++ Completion/Core/_main_complete	2000/04/12 09:25:20
@@ -19,7 +19,7 @@
 setopt localoptions nullglob rcexpandparam extendedglob
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 
-local func funcs ret=1 tmp _compskip format \
+local func funcs ret=1 tmp _compskip format nm \
       _completers _completer _completer_num curtag \
       _matchers _matcher _matcher_num _comp_tags \
       context state line opt_args val_args curcontext="$curcontext" \
@@ -105,8 +105,9 @@
 done
 
 curcontext="${curcontext/:[^:]#:/::}"
+nm=$compstate[nmatches]
 
-if [[ $compstate[old_list] = keep || $compstate[nmatches] -gt 1 ]]; then
+if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
   [[ _last_nmatches -ge 0 && _last_nmatches -ne $compstate[nmatches] ]] &&
       _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
 
@@ -160,7 +161,7 @@
       fi
     fi
   fi
-elif [[ $compstate[nmatches] -eq 0 &&
+elif [[ nm -eq 0 &&
         $#_lastdescr -ne 0 && $compstate[old_list] != keep ]] &&
      zstyle -s ":completion:${curcontext}:warnings" format format; then
 
@@ -195,6 +196,7 @@
 done
 
 _lastcomp=( "${(@kv)compstate}" )
+_lastcomp[nmatches]=$nm
 _lastcomp[completer]="$_completer"
 _lastcomp[prefix]="$PREFIX"
 _lastcomp[suffix]="$SUFFIX"
Index: Completion/Core/_oldlist
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_oldlist,v
retrieving revision 1.4
diff -u -r1.4 _oldlist
--- Completion/Core/_oldlist	2000/04/11 10:42:15	1.4
+++ Completion/Core/_oldlist	2000/04/12 09:25:20
@@ -35,6 +35,7 @@
 # existing list (even if it was generated by another widget).
 
 if [[ -z $compstate[old_insert] && -n $compstate[old_list] &&
+      ( $_lastcomp[nmatches] -ne 0 || $WIDGET != $LASTWIDGET ) &&
       $LASTWIDGET != _complete_help && $WIDGET != _complete_help ]]; then
   compstate[old_list]=keep
   return 0

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author