From 7ad0001183688c56bd1edfc8fc08467e380910a4 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 28 Sep 2016 17:46:37 +0000 Subject: 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/ --- Completion/X/Command/_rdesktop | 3 +-- Completion/X/Command/_x_utils | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'Completion/X') 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;; -- cgit 1.4.1