about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-28 17:46:37 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-10-07 13:56:31 +0000
commit7ad0001183688c56bd1edfc8fc08467e380910a4 (patch)
tree7df8833fee6f39f5a77dacec68f5824077418886 /Completion/X
parenta96e34b459d55240b0f4af37ac73aca916720883 (diff)
downloadzsh-7ad0001183688c56bd1edfc8fc08467e380910a4.tar.gz
zsh-7ad0001183688c56bd1edfc8fc08467e380910a4.tar.xz
zsh-7ad0001183688c56bd1edfc8fc08467e380910a4.zip
39479 + 39481 minus _path_files hunk (see 39489): Completion: audit 'compset -P' calls to use shortest match where applicable, plus random drive-by tweaks.
Found by grepping for patterns that can match needles of various lengths:

    :grep 'compset -[PS].*[\#^*()\|<>?~\]' Completion/
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Command/_rdesktop3
-rw-r--r--Completion/X/Command/_x_utils8
2 files changed, 7 insertions, 4 deletions
diff --git a/Completion/X/Command/_rdesktop b/Completion/X/Command/_rdesktop
index 5e480b333..55a6ea7b5 100644
--- a/Completion/X/Command/_rdesktop
+++ b/Completion/X/Command/_rdesktop
@@ -89,9 +89,8 @@ case $state in
   ;;
   redirection)
     redir="${PREFIX%%:*}"
-    if compset -P '*='; then
+    if compset -P 1 '*='; then
       curcontext="${curcontext%:*}:$redir"
-      compset -P '*='
       case $redir in
 	comport|lptport) _wanted devices expl device _files -g '*(-%)' && ret=0 ;;
 	disk) _directories && ret=0 ;;
diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils
index ebc6aacbf..13c5572af 100644
--- a/Completion/X/Command/_x_utils
+++ b/Completion/X/Command/_x_utils
@@ -82,12 +82,16 @@ xev)
 xhost)
   local type tmp match
 
+  if [[ -z $PREFIX ]]; then
+    _describe prefixes '(-:disallow +:allow)' -S '' -r ''
+  fi
+
   if compset -P '-'; then
     tmp=(${(f)"$(xhost)"})
     shift tmp
     tmp=(${tmp:#LOCAL:|<*>})
     if [[ "$tmp" = *:* ]]; then
-      if compset -P '(#b)(*):'; then
+      if compset -P 1 '(#b)(*):'; then
 	type="$match[1]"
 	_tags displays
 	while _tags; do
@@ -118,7 +122,7 @@ xhost)
 
     if [[ "$PREFIX" = *:* ]]; then
       type="${(L)PREFIX%%:*}"
-      compset -P '*:'
+      compset -P 1 '*:'
 
       case "$type" in
       inet) _hosts && ret=0;;