Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Preserve initial // in path name completion
- X-seq: zsh-workers 15400
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: Re: Preserve initial // in path name completion
- Date: Tue, 17 Jul 2001 11:02:36 +0200 (MET DST)
- In-reply-to: <000601c10b96$6da3dd20$21c9ca95@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author