diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-27 01:20:56 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-27 01:35:05 +0900 |
| commit | 2f51eb2b414f3e27f0d3ab3f4ef1a3f3a48c6d06 (patch) | |
| tree | 6ad0a17d17eaa2dd18d2575375ed9d22cecd2337 /test | |
| parent | 0ccbd79e10813f7fb67cd29687203ef3cd0d5692 (diff) | |
| download | fzf-2f51eb2b414f3e27f0d3ab3f4ef1a3f3a48c6d06.tar.gz | |
Different marker for the first and last line of multi-line entries
Can be configured via `--marker-multi-line`
Diffstat (limited to 'test')
| -rwxr-xr-x | test/test_go.rb | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/test/test_go.rb b/test/test_go.rb index 06c3aefd..dfb338e8 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -2752,8 +2752,9 @@ class TestGoFZF < TestBase def assert_block(expected, lines) cols = expected.lines.map(&:chomp).map(&:length).max - actual = lines.reverse.take(expected.lines.length).reverse.map { _1[0, cols].rstrip + "\n" }.join - assert_equal_org expected, actual + top = lines.take(expected.lines.length).map { _1[0, cols].rstrip + "\n" }.join + bottom = lines.reverse.take(expected.lines.length).reverse.map { _1[0, cols].rstrip + "\n" }.join + assert_includes [top, bottom], expected end def test_height_range_fit @@ -3268,6 +3269,55 @@ class TestGoFZF < TestBase tmux.send_keys '99' tmux.until { |lines| assert(lines.any? { |line| line.include?('0 / 0') }) } end + + def test_fzf_multi_line + tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded], :Enter + block = <<~BLOCK + │ ┃998 + │ ┃999 + │ ┃1000 + │ ╹ + │ ╻1 + │ ╹2 + │ >>0 + │ 3/3 (3) + │ > + ╰─────────── + BLOCK + tmux.until { assert_block(block, _1) } + tmux.send_keys :Up, :Up + block = <<~BLOCK + ╭─────── + │ >╻1 + │ >┃2 + │ >┃3 + BLOCK + tmux.until { assert_block(block, _1) } + + block = <<~BLOCK + │ >┃ + │ + │ > + ╰─── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_fzf_multi_line_reverse + tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded --reverse], :Enter + block = <<~BLOCK + ╭─────────── + │ > + │ 3/3 (3) + │ >>0 + │ ╻1 + │ ╹2 + │ ╻1 + │ ┃2 + │ ┃3 + BLOCK + tmux.until { assert_block(block, _1) } + end end module TestShell |
