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

Different marker for the first and last line of multi-line entries

Can be configured via `--marker-multi-line`
This commit is contained in:
Junegunn Choi
2024-05-27 01:20:56 +09:00
parent 0ccbd79e10
commit 2f51eb2b41
6 changed files with 323 additions and 139 deletions

View File

@@ -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