zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: PATCH: Re: Preserve initial // in path name completion
Date: Tue, 17 Jul 2001 11:02:36 +0200 (MET DST)	[thread overview]
Message-ID: <200107170902.LAA02108@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <000601c10b96$6da3dd20$21c9ca95@mow.siemens.ru>

Andrej Borsenkow wrote:

> I just realized and verified that the original patch (15278) allows to
> complete after x:/, so I guess it should go in. Probably in both HEAD and
> 4.0

Ok.  Andrej could you please check if what I wrote in the docs is
correct (the Cygwin example in particular).


Bye
  Sven

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.8
diff -u -r1.8 _path_files
--- Completion/Unix/Type/_path_files	2001/07/13 08:09:52	1.8
+++ Completion/Unix/Type/_path_files	2001/07/17 09:00:11
@@ -268,7 +268,15 @@
   linepath=
   realpath=
 
-  if [[ "$pre[1]" = / ]]; then
+  if zstyle -s ":completion:${curcontext}:" preserve-prefix tmp1 &&
+     [[ -n "$tmp1" && "$pre" = (#b)(${~tmp1})* ]]; then
+
+    pre="$pre[${#match[1]}+1,-1]"
+    orig="$orig[${#match[1]}+1,-1]"
+    donepath="$match[1]"
+    prepaths=( '' )
+
+  elif [[ "$pre[1]" = / ]]; then
     # If it is a absolute path name, we remove the first slash and put it in
     # `donepath' meaning that we treat it as the path that was already handled.
     # Also, we don't use the paths from `-W'.
Index: Completion/Zsh/Command/_zstyle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_zstyle,v
retrieving revision 1.1
diff -u -r1.1 _zstyle
--- Completion/Zsh/Command/_zstyle	2001/04/02 11:34:11	1.1
+++ Completion/Zsh/Command/_zstyle	2001/07/17 09:00:11
@@ -75,6 +75,7 @@
   ports			 c:_ports
   prefix-hidden		 c:bool
   prefix-needed		 c:bool
+  preserve-prefix        c:preserve-prefix
   range                  c:
   regular                c:bool
   remote-access		 c:bool
@@ -302,6 +303,10 @@
 
     insunambig) 
       _wanted values expl 'insert unambiguous string' compadd true false pattern
+      ;;
+
+    preserve-prefix)
+      _message 'pattern matching prefix to keep'
       ;;
 
     urgh) 
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.128
diff -u -r1.128 compsys.yo
--- Doc/Zsh/compsys.yo	2001/06/06 09:50:39	1.128
+++ Doc/Zsh/compsys.yo	2001/07/17 09:00:14
@@ -1834,6 +1834,16 @@
 
 The default style for this style is `true'.
 )
+kindex(preserve-prefix, completion style)
+item(tt(preserve-prefix))(
+This style is used when completing path names.  Its value should be a
+pattern matching an initial prefix of the word to complete that should
+be left unchanged under all circumstances.  For example, on some Unices
+an initial `tt(//)' (double slash) has a special meaning and hence
+should be kept.  For that one could set this style to the string
+`tt(//)'.  As another example, setting this style to `tt(?:/)' under
+Cygwin would allow completion after `tt(a:/...)' and the like.
+)
 kindex(range, completion style)
 item(tt(range))(
 This is used by the tt(_history) completer and the

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


      reply	other threads:[~2001-07-17  9:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-06  5:14 Andrej Borsenkow
2001-07-06  9:24 ` Sven Wischnowsky
2001-07-06 10:32   ` Andrej Borsenkow
2001-07-06 10:41     ` Sven Wischnowsky
2001-07-06 11:03       ` Andrej Borsenkow
2001-07-06 11:16         ` Andrej Borsenkow
2001-07-06 12:22         ` Sven Wischnowsky
2001-07-06 12:34           ` Andrej Borsenkow
2001-07-13 12:22           ` Andrej Borsenkow
2001-07-17  9:02             ` Sven Wischnowsky [this message]

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=200107170902.LAA02108@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.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).