[gvfs] completion: Fix completion for uris



commit e009e60a3fb2f8fb48d982fe66469c9f16678620
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Jun 18 09:53:14 2015 +0200

    completion: Fix completion for uris
    
    Bash completion currently doesn't work for paths with colons, because
    ${COMP_WORDS[COMP_CWORD]} provides path only after the colon.
    Colon is considered as a wordbreak. Therefor _get_comp_words_by_ref
    should be used to avoid breaking path on the colons.
    
    The macro also handles cases where user is completing in the middle
    of a word.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751145

 programs/completion/gvfs-cat |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/programs/completion/gvfs-cat b/programs/completion/gvfs-cat
index 4eb4dae..2226d10 100755
--- a/programs/completion/gvfs-cat
+++ b/programs/completion/gvfs-cat
@@ -25,7 +25,8 @@
 
 __gvfs_multiple_uris() {
     local IFS=$'\n'
-    local cur="${COMP_WORDS[COMP_CWORD]}"
+    local cur
+    _get_comp_words_by_ref -n : cur
 
     COMPREPLY=($(compgen -W '$(gvfs-ls --show-completions "$cur")' -- ""))
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]