[bash] Fix --query argument of CTRL-R

Fix #1898
pull/1903/head
Junegunn Choi 4 years ago
parent e34c7c00b1
commit b2c0413a98
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

@ -56,7 +56,7 @@ __fzf_history__() {
output=$(
builtin fc -lnr -2147483648 |
last_hist=$(HISTTIMEFORMAT='' builtin history 1) perl -p -l0 -e 'BEGIN { getc; $/ = "\n\t"; $HISTCMD = $ENV{last_hist} + 1 } s/^[ *]//; $_ = $HISTCMD - $. . "\t$_"' |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m --query $(printf %q "$READLINE_LINE") --read0" $(__fzfcmd)
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m --read0" $(__fzfcmd) --query "$READLINE_LINE"
) || return
READLINE_LINE=${output#*$'\t'}
if [ -z "$READLINE_POINT" ]; then

@ -1853,12 +1853,15 @@ module TestShell
def test_ctrl_r_abort
skip "doesn't restore the original line when search is aborted pre Bash 4" if shell == :bash && /(?<= version )\d+/.match(`#{Shell.bash} --version`).to_s.to_i < 4
tmux.send_keys 'foo'
tmux.until { |lines| lines[-1].start_with? 'foo' }
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-1].start_with? '>' }
tmux.send_keys 'C-g'
tmux.until { |lines| lines[-1].start_with? 'foo' }
%w[foo ' "].each do |query|
tmux.prepare
tmux.send_keys(query)
tmux.until { |lines| lines[-1].start_with? query }
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-1] == "> #{query}" }
tmux.send_keys 'C-g'
tmux.until { |lines| lines[-1].start_with? query }
end
end
def retries(times = 3)

Loading…
Cancel
Save