From 07aee79bd8804bbee88bfc9db7f694940a227ea3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 27 Nov 2013 01:00:23 +0900 Subject: Update examples and bash completion - Use tput sc/rc instead of redraw-current-line - Escape selected items with printf --- fzf-completion.bash | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'fzf-completion.bash') diff --git a/fzf-completion.bash b/fzf-completion.bash index c4aca319..6697b372 100644 --- a/fzf-completion.bash +++ b/fzf-completion.bash @@ -46,12 +46,9 @@ _fzf_generic_completion() { leftover=${base/#"$dir"} leftover=${leftover/#\/} [ "$dir" = './' ] && dir='' + tput sc matches=$(find "$dir"* $1 2> /dev/null | fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do - if [[ ${item} =~ \ ]]; then - echo -n "\"$item\" " - else - echo -n "$item " - fi + printf '%q ' "$item" done) matches=${matches% } if [ -n "$matches" ]; then @@ -59,6 +56,7 @@ _fzf_generic_completion() { else COMPREPLY=( "$cur" ) fi + tput rc return 0 fi dir=$(dirname "$dir") @@ -110,7 +108,3 @@ for cmd in " complete -F _fzf_all_completion -o default -o bashdefault $cmd done -bind '"\e\e": complete' -bind '"\er": redraw-current-line' -bind '"\C-i": "\e\e\er"' - -- cgit v1.2.3