about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-08-25 01:19:50 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-08-27 18:12:01 +0000
commitb62d9eb63eb5c9a20c4f38a180f339d36c4b5136 (patch)
treebca16c33321a5284f726596669f9f14aace9b3d4
parentaa041f7a5a970d2b03756b730caa185eef39f8f0 (diff)
downloadzsh-b62d9eb63eb5c9a20c4f38a180f339d36c4b5136.tar.gz
zsh-b62d9eb63eb5c9a20c4f38a180f339d36c4b5136.tar.xz
zsh-b62d9eb63eb5c9a20c4f38a180f339d36c4b5136.zip
39103: _typed-in_absolute_command_paths: Better handle non-empty arguments that don't start with a slash.
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Type/_absolute_command_paths8
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9927f21e9..9dd1ef17d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2016-08-27  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 39103: Completion/Unix/Type/_absolute_command_paths:
+	_typed-in_absolute_command_paths: Better handle non-empty
+	arguments that don't start with a slash.
+
 	* 39070: Completion/Unix/Command/_mount,
 	Completion/Unix/Type/_canonical_paths: umount: Complete /f/b<TAB>
 	→ /foo/bar (for absolute path arguments only, for now)
diff --git a/Completion/Unix/Type/_absolute_command_paths b/Completion/Unix/Type/_absolute_command_paths
index e9ab17023..4d9f79380 100644
--- a/Completion/Unix/Type/_absolute_command_paths
+++ b/Completion/Unix/Type/_absolute_command_paths
@@ -16,7 +16,13 @@ _hashed_absolute_command_paths() {
 # This function completes absolute pathnames of executables, e.g., /etc/rc.local
 _typed-in_absolute_command_paths() {
   # TODO: the description "full path to an executable" and tag in the caller are ignored by _path_files
-  _path_files -/ -g '*(-*)' -P / -W /
+  if [[ -z $PREFIX ]]; then
+    _path_files -/ -g '*(-*)' -P / -W /
+  elif [[ $PREFIX[1] == / ]]; then
+    _path_files -/ -g '*(-*)' -W /
+  else
+    return 1
+  fi
 }
 
 _absolute_command_paths() {