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

incremental matchers in matcher-list



Not sure just how useful it is.

It allows you to add matchers to previous list instead of replacing them to
avoid repetitions. I expect most common usage to try more general patterns in
turn, so it allows you to do

zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' '+r:|[._-]=* r:|=*'
'+r:|[.-]=** r:|=**'

without repeating ealrlier patterns everytime.

If it accepted, doc and compinstall will follow.

-andrej

Have a nice DOS!
B >>

Index: Completion/Core/_ignored
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_ignored,v
retrieving revision 1.4
diff -u -r1.4 _ignored
--- Completion/Core/_ignored    2000/06/26 09:36:12     1.4
+++ Completion/Core/_ignored    2001/02/23 09:33:49
@@ -10,7 +10,8 @@
   comp=( "${(@)_completers[1,_completer_num-1][(R)_ignored(|:*),-1]}" )

 local _comp_no_ignore=yes tmp expl \
-      _completer _completer_num _matcher _matchers _matcher_num
+      _completer _completer_num \
+      _matcher _c_matcher _matchers _matcher_num

 _completer_num=1

@@ -30,7 +31,13 @@
       _matchers=( '' )

   _matcher_num=1
-  for _matcher in "$_matchers[@]"; do
+  _matcher=''
+  for _c_matcher in "$_matchers[@]"; do
+    if [[ "$_c_matcher" == +* ]]; then
+      _matcher="$_matcher $_c_matcher[2,-1]"
+    else
+      _matcher="$_c_matcher"
+    fi
     if [[ "$tmp" != _ignored ]] && "$tmp"; then
       if zstyle -s ":completion:${curcontext}:" single-ignored tmp &&
          [[ $compstate[old_list] != shown &&
Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.43
diff -u -r1.43 _main_complete
--- Completion/Core/_main_complete      2000/10/19 08:58:17     1.43
+++ Completion/Core/_main_complete      2001/02/23 09:33:49
@@ -25,8 +25,8 @@

 local func funcs ret=1 tmp _compskip format nm call match min max i num\
       _completers _completer _completer_num curtag _comp_force_list \
-      _matchers _matcher _matcher_num _comp_tags _comp_mesg mesg str \
-      context state line opt_args val_args curcontext="$curcontext" \
+      _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg  \
+      mesg str context state line opt_args val_args curcontext="$curcontext"
\
       _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \
       _saved_exact="${compstate[exact]}" \
       _saved_lastprompt="${compstate[last_prompt]}" \
@@ -143,7 +143,14 @@
       _matchers=( '' )

   _matcher_num=1
-  for _matcher in "$_matchers[@]"; do
+  _matcher=''
+  for _c_matcher in "$_matchers[@]"; do
+    if [[ "$_c_matcher" == +* ]]; then
+      _matcher="$_matcher $_c_matcher[2,-1]"
+    else
+      _matcher="$_c_matcher"
+    fi
+
     _comp_mesg=
     if [[ -n "$call" ]]; then
       if "${(@)argv[3,-1]}"; then
Index: Completion/Core/_prefix
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_prefix,v
retrieving revision 1.3
diff -u -r1.3 _prefix
--- Completion/Core/_prefix     2000/05/08 08:16:32     1.3
+++ Completion/Core/_prefix     2001/02/23 09:33:49
@@ -5,7 +5,8 @@
 [[ _matcher_num -gt 1 || -z "$SUFFIX" ]] && return 1

 local comp curcontext="$curcontext" tmp \
-      _completer _completer_num _matcher _matchers _matcher_num
+      _completer _completer_num \
+      _matcher _c_matcher _matchers _matcher_num

 zstyle -a ":completion:${curcontext}:" completer comp ||
   comp=( "${(@)_completers[1,_completer_num-1][(R)_prefix(|:*),-1]}" )
@@ -35,7 +36,14 @@
       _matchers=( '' )

   _matcher_num=1
-  for _matcher in "$_matchers[@]"; do
+  _matcher=''
+  for _c_matcher in "$_matchers[@]"; do
+    if [[ "$_c_matcher" == +* ]]; then
+      _matcher="$_matcher $_c_matcher[2,-1]"
+    else
+      _matcher="$_c_matcher"
+    fi
+
     [[ "$tmp" != _prefix ]] && "$tmp" && return 0
     (( _matcher_num++ ))
   done



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