Revert "[bash] Do not append space when path completion is cancelled"
This reverts commit 376a76d1d3
as it
affects normal completion
This commit is contained in:
parent
376a76d1d3
commit
9d2c6a95f4
@ -151,7 +151,7 @@ __fzf_generic_path_completion() {
|
|||||||
matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" $fzf $2 -q "$leftover" | while read -r item; do
|
matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" $fzf $2 -q "$leftover" | while read -r item; do
|
||||||
printf "%q$3 " "$item"
|
printf "%q$3 " "$item"
|
||||||
done)
|
done)
|
||||||
[ $4 = 1 ] && matches=${matches% }
|
matches=${matches% }
|
||||||
if [ -n "$matches" ]; then
|
if [ -n "$matches" ]; then
|
||||||
COMPREPLY=( "$matches" )
|
COMPREPLY=( "$matches" )
|
||||||
else
|
else
|
||||||
@ -167,7 +167,6 @@ __fzf_generic_path_completion() {
|
|||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
shift
|
|
||||||
_fzf_handle_dynamic_completion "$cmd" "$@"
|
_fzf_handle_dynamic_completion "$cmd" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -199,7 +198,7 @@ _fzf_complete() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_fzf_path_completion() {
|
_fzf_path_completion() {
|
||||||
__fzf_generic_path_completion _fzf_compgen_path "-m" "" 0 "$@"
|
__fzf_generic_path_completion _fzf_compgen_path "-m" "" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Deprecated. No file only completion.
|
# Deprecated. No file only completion.
|
||||||
@ -208,7 +207,7 @@ _fzf_file_completion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_fzf_dir_completion() {
|
_fzf_dir_completion() {
|
||||||
__fzf_generic_path_completion _fzf_compgen_dir "" "/" 1 "$@"
|
__fzf_generic_path_completion _fzf_compgen_dir "" "/" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
_fzf_complete_kill() {
|
_fzf_complete_kill() {
|
||||||
@ -300,7 +299,7 @@ _fzf_defc() {
|
|||||||
|
|
||||||
# Anything
|
# Anything
|
||||||
for cmd in $a_cmds; do
|
for cmd in $a_cmds; do
|
||||||
_fzf_defc "$cmd" _fzf_path_completion "-o nospace -o default -o bashdefault"
|
_fzf_defc "$cmd" _fzf_path_completion "-o default -o bashdefault"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Directory
|
# Directory
|
||||||
|
@ -1482,19 +1482,6 @@ module CompletionTest
|
|||||||
tmux.send_keys :Enter
|
tmux.send_keys :Enter
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_completion_cancel
|
|
||||||
%w[ls cd].each do |cmd|
|
|
||||||
tmux.prepare
|
|
||||||
tmux.send_keys "#{cmd} **", :Tab
|
|
||||||
tmux.until { |lines| lines.item_count > 0 }
|
|
||||||
tmux.send_keys 'C-c'
|
|
||||||
tmux.until { |lines| lines[-1].include?('**') }
|
|
||||||
tmux.send_keys 'xoxo'
|
|
||||||
tmux.until { |lines| lines[-1].include?('**xoxo') }
|
|
||||||
tmux.send_keys 'C-u'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_dir_completion
|
def test_dir_completion
|
||||||
(1..100).each do |idx|
|
(1..100).each do |idx|
|
||||||
FileUtils.mkdir_p "/tmp/fzf-test/d#{idx}"
|
FileUtils.mkdir_p "/tmp/fzf-test/d#{idx}"
|
||||||
|
Loading…
Reference in New Issue
Block a user