summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-04-15 01:19:02 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-04-18 20:14:47 +0000
commit6cc6942cf5df0bff0a39da2e1707c82ad0987f66 (patch)
treefa157645695a08d9b5b94cf097544f36fd177fd5
parentfc96274801f38f20063c904e0eaa98a23ee2e74c (diff)
downloadzsh-6cc6942cf5df0bff0a39da2e1707c82ad0987f66.tar.gz
zsh-6cc6942cf5df0bff0a39da2e1707c82ad0987f66.tar.xz
zsh-6cc6942cf5df0bff0a39da2e1707c82ad0987f66.zip
40973: _remote_files: Fix completion of remote files that start with a hyphen/minus.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_remote_files6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1bb23d17f..4595c56d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-18  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 40973: Completion/Unix/Type/_remote_files: Fix completion of
+	remote files that start with a hyphen/minus.
+
 2017-04-15  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 40977: Src/init.c: "emulate" disallows "--help" and "--version"
diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files
index 1e9fed15e..a5fce9afd 100644
--- a/Completion/Unix/Type/_remote_files
+++ b/Completion/Unix/Type/_remote_files
@@ -58,11 +58,13 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then
     else rempat="${(q)PREFIX%%[^./][^/]#}\*"
   fi
 
+  # remote filenames
   remfiles=(${(M)${(f)"$(_call_program files $cmd $cmd_args $host ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
 
   compset -P '*/'
   compset -S '/*' || (( ${args[(I)-/]} )) || suf='remote file'
 
+  # display strings for remote files and directories
   remdispf=(${remfiles:#*/})
   remdispd=(${(M)remfiles:#*/})
 
@@ -77,9 +79,9 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then
   while _tags; do
     while _next_label files expl ${suf:-remote directory}; do
       [[ -n $suf ]] &&
-          compadd "$args[@]" "$expl[@]" -d remdispf ${(q)remdispf%[*=|]} && ret=0
+          compadd "$args[@]" "$expl[@]" -d remdispf -- ${(q)remdispf%[*=|]} && ret=0
       compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd \
-	${(q)remdispd%/} && ret=0
+	-- ${(q)remdispd%/} && ret=0
     done
     (( ret )) || return 0
   done