mirror of
https://github.com/junegunn/fzf.git
synced 2025-07-31 20:22:01 -07:00
Add --header-lines-border to separate two headers
Examples: # Border only around the header from --header-lines seq 10 | fzf --header 'hello' --header-lines 2 --header-lines-border # Both headers with borders seq 10 | fzf --header 'hello' --header-lines 2 --header-border --header-lines-border # Use 'none' to still separate two headers but without a border seq 10 | fzf --header 'hello' --header-lines 2 --header-border --header-lines-border none --list-border
This commit is contained in:
198
test/test_go.rb
198
test/test_go.rb
@@ -3600,6 +3600,180 @@ class TestGoFZF < TestBase
|
||||
tmux.until { assert_block(block, _1) }
|
||||
end
|
||||
|
||||
def test_header_border_toggle
|
||||
tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()'), :Enter
|
||||
block1 = <<~BLOCK
|
||||
│ 5
|
||||
│ 4
|
||||
│ 3
|
||||
│ 2
|
||||
│ > 1
|
||||
│ 100/100 ─
|
||||
│ >
|
||||
╰────────────
|
||||
BLOCK
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
|
||||
tmux.send_keys :Space
|
||||
block2 = <<~BLOCK
|
||||
│ 3
|
||||
│ 2
|
||||
│ > 1
|
||||
╰────────────
|
||||
╭────────────
|
||||
│ hello
|
||||
╰────────────
|
||||
100/100 ─
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block2, _1) }
|
||||
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
end
|
||||
|
||||
def test_header_border_toggle_with_header_lines
|
||||
tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()' --header-lines 2), :Enter
|
||||
block1 = <<~BLOCK
|
||||
│ 5
|
||||
│ 4
|
||||
│ > 3
|
||||
╰──────────
|
||||
╭──────────
|
||||
│ 2
|
||||
│ 1
|
||||
╰──────────
|
||||
98/98 ─
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
|
||||
tmux.send_keys :Space
|
||||
block2 = <<~BLOCK
|
||||
│ 4
|
||||
│ > 3
|
||||
╰──────────
|
||||
╭──────────
|
||||
│ 2
|
||||
│ 1
|
||||
│ hello
|
||||
╰──────────
|
||||
98/98 ─
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block2, _1) }
|
||||
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
end
|
||||
|
||||
def test_header_border_toggle_with_header_lines_header_first
|
||||
tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()' --header-lines 2 --header-first), :Enter
|
||||
block1 = <<~BLOCK
|
||||
│ 5
|
||||
│ 4
|
||||
│ > 3
|
||||
╰──────────
|
||||
98/98 ─
|
||||
>
|
||||
╭──────────
|
||||
│ 2
|
||||
│ 1
|
||||
╰──────────
|
||||
BLOCK
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
|
||||
tmux.send_keys :Space
|
||||
block2 = <<~BLOCK
|
||||
│ 4
|
||||
│ > 3
|
||||
╰──────────
|
||||
98/98 ─
|
||||
>
|
||||
╭──────────
|
||||
│ 2
|
||||
│ 1
|
||||
│ hello
|
||||
╰──────────
|
||||
BLOCK
|
||||
tmux.until { assert_block(block2, _1) }
|
||||
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
end
|
||||
|
||||
def test_header_border_toggle_with_header_lines_header_lines_border
|
||||
tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()' --header-lines 2 --header-lines-border double), :Enter
|
||||
block1 = <<~BLOCK
|
||||
│ 5
|
||||
│ 4
|
||||
│ > 3
|
||||
╰──────────
|
||||
╔══════════
|
||||
║ 2
|
||||
║ 1
|
||||
╚══════════
|
||||
98/98 ─
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
|
||||
tmux.send_keys :Space
|
||||
block2 = <<~BLOCK
|
||||
│ > 3
|
||||
╰──────────
|
||||
╔══════════
|
||||
║ 2
|
||||
║ 1
|
||||
╚══════════
|
||||
╭──────────
|
||||
│ hello
|
||||
╰──────────
|
||||
98/98 ─
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block2, _1) }
|
||||
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
end
|
||||
|
||||
def test_header_border_toggle_with_header_lines_header_first_header_lines_border
|
||||
tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()' --header-lines 2 --header-first --header-lines-border double), :Enter
|
||||
block1 = <<~BLOCK
|
||||
│ 5
|
||||
│ 4
|
||||
│ > 3
|
||||
╰──────────
|
||||
╔══════════
|
||||
║ 2
|
||||
║ 1
|
||||
╚══════════
|
||||
98/98 ─
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
|
||||
tmux.send_keys :Space
|
||||
block2 = <<~BLOCK
|
||||
│ > 3
|
||||
╰──────────
|
||||
╔══════════
|
||||
║ 2
|
||||
║ 1
|
||||
╚══════════
|
||||
98/98 ─
|
||||
>
|
||||
╭──────────
|
||||
│ hello
|
||||
╰──────────
|
||||
BLOCK
|
||||
tmux.until { assert_block(block2, _1) }
|
||||
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { assert_block(block1, _1) }
|
||||
end
|
||||
|
||||
def test_header_border_and_label_header_first
|
||||
tmux.send_keys %(seq 100 | #{FZF} --border rounded --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --header-first), :Enter
|
||||
block = <<~BLOCK
|
||||
@@ -3625,16 +3799,16 @@ class TestGoFZF < TestBase
|
||||
│ ║ 12
|
||||
│ ║ 11
|
||||
│ ║ > 10
|
||||
│ ╚list════
|
||||
│ ┌────────
|
||||
│ ╚list══════
|
||||
│ ┌──────────
|
||||
│ │ 3
|
||||
│ │ 2
|
||||
│ │ 1
|
||||
│ └header──
|
||||
│ 19/97 ─
|
||||
│ > 1
|
||||
│ └header────
|
||||
│ 19/97 ─
|
||||
│ > 1
|
||||
│
|
||||
╰────────────
|
||||
╰──────────────
|
||||
BLOCK
|
||||
tmux.until { assert_block(block, _1) }
|
||||
end
|
||||
@@ -3645,16 +3819,16 @@ class TestGoFZF < TestBase
|
||||
│ ║ 12
|
||||
│ ║ 11
|
||||
│ ║ > 10
|
||||
│ ╚list════
|
||||
│ 19/97 ─
|
||||
│ > 1
|
||||
│ ┌────────
|
||||
│ ╚list══════
|
||||
│ 19/97 ─
|
||||
│ > 1
|
||||
│ ┌──────────
|
||||
│ │ 3
|
||||
│ │ 2
|
||||
│ │ 1
|
||||
│ └header──
|
||||
│ └header────
|
||||
│
|
||||
╰────────────
|
||||
╰──────────────
|
||||
BLOCK
|
||||
tmux.until { assert_block(block, _1) }
|
||||
end
|
||||
|
Reference in New Issue
Block a user