summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-03-07 15:19:19 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-03-07 15:19:19 +0000
commit93572c7bb69e0923377066a323c4654f2c7b3028 (patch)
treed7955a615e99ee47e7d8d21727a15a2df22098c9
parent74c90c0ada5db4e152c62aa6febd265a4626186f (diff)
downloadzsh-93572c7bb69e0923377066a323c4654f2c7b3028.tar.gz
zsh-93572c7bb69e0923377066a323c4654f2c7b3028.tar.xz
zsh-93572c7bb69e0923377066a323c4654f2c7b3028.zip
18327: add handling for preserve-prefix to compinstall
-rw-r--r--ChangeLog2
-rw-r--r--Completion/compinstall24
2 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9fdae7a82..cfacc0231 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2003-03-07  Peter Stephenson  <pws@csr.com>
 
+	* 18327: Completion/compinstall: add handling for preserve-prefix.
+
 	* 18325: Src/Modules/parameter.c: options on by default weren't
 	handled correctly.
 
diff --git a/Completion/compinstall b/Completion/compinstall
index b8dec7724..c53d12e34 100644
--- a/Completion/compinstall
+++ b/Completion/compinstall
@@ -1529,7 +1529,7 @@ completions?
 #       squeeze-slashes,
 __ci_do_file_styles() {
   local key files cursor expand speciald ignorep squeezes select
-  local prefon suffon lssuffixes
+  local prefon suffon lssuffixes preserve
 
   __ci_get_this_style file-sort files
   __ci_get_this_style ignore-parents ignorep
@@ -1537,6 +1537,8 @@ __ci_do_file_styles() {
   __ci_get_this_style squeeze-slashes squeezes
   __ci_get_this_style expand expand
   __ci_get_this_style list-suffixes lssuffixes
+  __ci_get_this_style preserve-prefix preserve
+  [[ -n $preserve ]] && preserve=${(Q)preserve}
 
   while true; do
     clear
@@ -1554,6 +1556,8 @@ __ci_do_file_styles() {
 5.  Configure how multiple paths are expanded and displayed, 
     e.g. /f/b -> /foo/bar
 
+6.  Keep certain prefixes unchanged, such as \`//resource/'.
+
 q.  Return without saving.
 0.  Done setting options for filename completion.
 "
@@ -1729,6 +1733,21 @@ Do you want this behaviour ([y]es, [n]o, [k]eep current setting)?
 	    ([nN]) lssuffixes=;;
 	  esac
 	  ;;
+      (6) print "\
+On some systems, there are special forms for the start of a filename
+which should be left alone by the completion system.  For example, Cygwin
+uses a double slash to indicate a network resource, hence a prefix of
+the form \`//resource/' should be left alone.  This style gives a pattern
+to match any such prefixes; alternatives separated by \`|' are therefore
+possible.  Edit the pattern as you like.  If this is empty, the shell will not
+handle any prefixes specially."
+          if [[ -z $preserve ]]; then
+	      preserve="//[^/]##/"
+	      print "
+Accept the default to handle network resources as just described."
+	  fi
+	  vared -eh -p "pattern> " preserve
+	  ;;
       (q) return 1
 	 ;;
     esac
@@ -1741,6 +1760,9 @@ Do you want this behaviour ([y]es, [n]o, [k]eep current setting)?
   __ci_set_this_style squeeze-slashes squeezes
   __ci_set_this_style expand expand
   __ci_set_this_style list-suffixes lssuffixes
+  # pattern, always quote
+  [[ -n $preserve ]] && preserve=${(qq)preserve}
+  __ci_set_this_style preserve-prefix preserve
 
   return 0
 }