mirror of
https://github.com/junegunn/fzf
synced 2026-08-11 20:11:42 +00:00
Copy the item text in replace-query
ToRunes aliases the rune array, and the editing actions append into
t.input in place when the cursor is not at the end, so the keystrokes
edit the item. Non-ASCII items only, ASCII gets a fresh slice.
printf '한글abcde\n' | fzf --bind 'ctrl-y:replace-query'
ctrl-y, Left, BSpace, ctrl-u -> 한글abcee
Runes and ToRunes are now documented read-only. A stale fold bit was the
other symptom, letting the prefilter reject an item the general path
matches.
This commit is contained in:
@@ -479,6 +479,19 @@ class TestCore < TestInteractive
|
||||
tmux.until { |lines| assert_equal '> 10', lines[-1] }
|
||||
end
|
||||
|
||||
def test_bind_replace_query_does_not_mutate_item
|
||||
tmux.send_keys "echo '한글abcde' | #{fzf('--bind=ctrl-j:replace-query,ctrl-o:clear-query')}", :Enter
|
||||
tmux.until { |lines| assert_equal ' 1/1', lines[-2] }
|
||||
tmux.send_keys 'C-j'
|
||||
tmux.until { |lines| assert_equal '> 한글abcde', lines[-1] }
|
||||
# Editing away from the end used to write into the item itself
|
||||
tmux.send_keys :Left, :BSpace
|
||||
tmux.until { |lines| assert_equal '> 한글abce', lines[-1] }
|
||||
tmux.send_keys 'C-o'
|
||||
tmux.until { |lines| assert_equal '>', lines[-1] }
|
||||
tmux.until { |lines| assert_equal '> 한글abcde', lines[-3] }
|
||||
end
|
||||
|
||||
def test_select_all_deselect_all_toggle_all
|
||||
tmux.send_keys "seq 100 | #{fzf('--bind ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle-all --multi')}", :Enter
|
||||
tmux.until { |lines| assert_equal ' 100/100 (0)', lines[-2] }
|
||||
|
||||
Reference in New Issue
Block a user