zsh-workers
 help / color / mirror / code / Atom feed
* Re: incremental matchers in matcher-list
@ 2001-02-23  9:43 Sven Wischnowsky
  2001-02-27 16:06 ` PATCH: " Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2001-02-23  9:43 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> 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.

Would be ok for me (a bit like Bart's zstyle+).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread
* incremental matchers in matcher-list
@ 2001-02-23  9:37 Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 2001-02-23  9:37 UTC (permalink / raw)
  To: ZSH Workers Mailing 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-02-27 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-23  9:43 incremental matchers in matcher-list Sven Wischnowsky
2001-02-27 16:06 ` PATCH: " Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2001-02-23  9:37 Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).