zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: ignore-line (was: Re: PATCH: Re: expansion)
Date: Fri, 16 Jun 2000 09:37:47 +0200 (MET DST)	[thread overview]
Message-ID: <200006160737.JAA12467@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Thu, 15 Jun 2000 17:15:32 +0200 (MET DST)


I wrote:

> ...
> 
> I want to integrate it with (the already existing) ignore-line style,
> three choices there: ignore all words from the line, ignore only the
> current word, ignore all words except the current one.

Here is the patchlet for that. You can now set ignore-line to `true'
(`yes',...), `current' (to ignore only the current word) and `other'
(to ignore all words except the current one).

For example, if you set it to `current' and you have the directories
foo and foobar and do `cd f<TAB>' you get `cd foo' and if you now hit
TAB again, this will complete to foobar.

Hm, this maybe we should allow `current listed' or some such to mean
`ignore the current word if the list of matches is shown'.

Bye
 Sven

Index: Completion/Core/_description
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_description,v
retrieving revision 1.6
diff -u -r1.6 _description
--- Completion/Core/_description	2000/05/23 08:54:30	1.6
+++ Completion/Core/_description	2000/06/16 07:31:39
@@ -30,15 +30,19 @@
 [[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
 
 if [[ -z "$_comp_no_ignore" ]]; then
-  if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
-    opts=( $opts -F _comp_ignore )
-    zstyle -t ":completion:${curcontext}:$1" ignore-line &&
-        _comp_ignore=( "$_comp_ignore[@]" "$words[@]" )
-  elif zstyle -t ":completion:${curcontext}:$1" ignore-line; then
-    _comp_ignore=( "$words[@]" )
-  else
+  zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
     _comp_ignore=()
-  fi
+
+  zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
+    case "$hidden" in
+    true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
+    current)       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
+    other)         _comp_ignore=( "$_comp_ignore[@]"
+                                  "${(@)words[1,CURRENT-1]}"
+				  "${(@)words[CURRENT+1,-1]}" );;
+    esac
+
+  (( $#_comp_ignore )) && opts=( $opts -F _comp_ignore )
 else
   _comp_ignore=()
 fi
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.66
diff -u -r1.66 compsys.yo
--- Doc/Zsh/compsys.yo	2000/06/16 07:31:09	1.66
+++ Doc/Zsh/compsys.yo	2000/06/16 07:31:44
@@ -1187,9 +1187,17 @@
 item(tt(ignore-line))(
 This style is tested for the tags used when generating matches.  If it
 is set to `true', then none of the words that are already on the line
-will be considered possible completions.
+will be considered possible completions.  If it is set to
+`tt(current)', the word the cursor is on will not be considered a
+possible completion and if it is set to `tt(other)' all words except
+the current one will not be considered to be a possible completion.
 
-Note that you almost certainly don't want to set this for a general
+The value `tt(current)' is a bit like the opposite of the
+tt(accept-exact). It means that only strings with missing characters
+will be completed.
+
+Note that you almost certainly don't want to set this to `true' or
+`tt(other)' for a general
 context such as `tt(:completion:*)'.  This is because it would disallow
 completion of, for example, options multiple times even if the command
 in question accepts the option more than once.

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


                 reply	other threads:[~2000-06-16  7:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200006160737.JAA12467@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).