m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 07:43:39 -05:00

[shell] Update CTRL-R to remove duplicate commands

Close #1940
Related: #1363 #749 #270 #49 #88 #492 #600
This commit is contained in:
Junegunn Choi
2020-03-29 21:26:52 +09:00
parent 079046863c
commit 18261fe31c
3 changed files with 7 additions and 4 deletions

View File

@@ -1839,15 +1839,18 @@ module TestShell
tmux.send_keys 'echo 1st', :Enter; tmux.prepare
tmux.send_keys 'echo 2nd', :Enter; tmux.prepare
tmux.send_keys 'echo 3d', :Enter; tmux.prepare
tmux.send_keys 'echo 3rd', :Enter; tmux.prepare
3.times { tmux.send_keys 'echo 3rd', :Enter; tmux.prepare }
tmux.send_keys 'echo 4th', :Enter
retries do
tmux.prepare
tmux.send_keys 'C-r'
tmux.until { |lines| lines.match_count.positive? }
end
tmux.send_keys 'C-r'
tmux.send_keys '3d'
# Duplicates removed: 3d (1) + 3rd (1) => 2 matches
tmux.until { |lines| lines.match_count == 2 }
tmux.until { |lines| lines[-3].end_with? 'echo 3d' }
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-3].end_with? 'echo 3rd' }
tmux.send_keys :Enter
tmux.until { |lines| lines[-1] == 'echo 3rd' }