summaryrefslogtreecommitdiff
path: root/shell/completion.bash
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2019-09-29 14:45:58 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2019-09-29 14:45:58 +0900
commita5a97be0178c59fb9670d534fce6ffe84cc01f66 (patch)
tree4d8ce9c8e7b6f76fa6f54bb27fc06963a15a8bc3 /shell/completion.bash
parent80b5bc1b682898e3089f6caf1120919fc0933562 (diff)
downloadfzf-a5a97be0178c59fb9670d534fce6ffe84cc01f66.tar.gz
[bash-completion] Properly handle exit event
Related #1704
Diffstat (limited to 'shell/completion.bash')
-rw-r--r--shell/completion.bash7
1 files changed, 4 insertions, 3 deletions
diff --git a/shell/completion.bash b/shell/completion.bash
index d0d40869..466ca059 100644
--- a/shell/completion.bash
+++ b/shell/completion.bash
@@ -195,12 +195,13 @@ _fzf_complete() {
selected=$(cat | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" $fzf $1 -q "$cur" | $post | tr '\n' ' ')
selected=${selected% } # Strip trailing space not to repeat "-o nospace"
- printf '\e[5n'
-
if [ -n "$selected" ]; then
COMPREPLY=("$selected")
- return 0
+ else
+ COMPREPLY=("$cur")
fi
+ printf '\e[5n'
+ return 0
else
shift
_fzf_handle_dynamic_completion "$cmd" "$@"