Skip to content
Myr

test_layout.rb

This file

Path

test/test_layout.rb

2,040 lines · 78.9 KiB · Ruby

Last changed by

Fix adaptive height with an inline header or footer borderJunegunn Choibefore adoption1372d04

History of this file

Take it

The walk stopped after 200 commits: lines older than 76efddd point at it.

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1–245why, one step back
1# frozen_string_literal: true
23require_relative 'lib/common'45# Test cases that mainly use assert_block to verify the layout of fzf6class TestLayout < TestInteractive7 def assert_block(expected, lines)8 cols = expected.lines.map { it.chomp.length }.max9 top = lines.take(expected.lines.length).map { it[0, cols].rstrip + "\n" }.join.chomp10 bottom = lines.reverse.take(expected.lines.length).reverse.map { it[0, cols].rstrip + "\n" }.join.chomp11 assert_includes [top, bottom], expected.chomp12 end1314 def test_vanilla15 tmux.send_keys "seq 1 100000 | #{fzf}", :Enter16 block = <<~BLOCK17 218 > 119 100000/10000020 >21 BLOCK22 tmux.until { assert_block(block, it) }2324 # Testing basic key bindings25 tmux.send_keys '99', 'C-a', '1', 'C-f', '3', 'C-b', 'C-h', 'C-u', 'C-e', 'C-y', 'C-k', 'Tab', 'BTab'26 block = <<~BLOCK27 > 391028 39129 856/10000030 > 39131 BLOCK32 tmux.until { assert_block(block, it) }3334 tmux.send_keys :Enter35 assert_equal '3910', fzf_output36 end3738 def test_header_first39 tmux.send_keys "seq 1000 | #{FZF} --header foobar --header-lines 3 --header-first", :Enter40 block = <<~OUTPUT41 > 442 343 244 145 997/99746 >47 foobar48 OUTPUT49 tmux.until { assert_block(block, it) }50 end5152 def test_header_first_reverse53 tmux.send_keys "seq 1000 | #{FZF} --header foobar --header-lines 3 --header-first --reverse --inline-info", :Enter54 block = <<~OUTPUT55 foobar56 > < 997/99757 158 259 360 > 461 OUTPUT62 tmux.until { assert_block(block, it) }63 end6465 def test_change_and_transform_header66 [67 'space:change-header:$(seq 4)',68 'space:transform-header:seq 4'69 ].each_with_index do |binding, i|70 tmux.send_keys %(seq 3 | #{FZF} --header-lines 2 --header bar --bind "#{binding}"), :Enter71 expected = <<~OUTPUT72 > 373 274 175 bar76 1/177 >78 OUTPUT79 tmux.until { assert_block(expected, it) }80 tmux.send_keys :Space81 expected = <<~OUTPUT82 > 383 284 185 186 287 388 489 1/190 >91 OUTPUT92 tmux.until { assert_block(expected, it) }93 next unless i.zero?9495 teardown96 setup97 end98 end99100 def test_change_header101 tmux.send_keys %(seq 3 | #{FZF} --header-lines 2 --header bar --bind "space:change-header:$(seq 4)"), :Enter102 expected = <<~OUTPUT103 > 3104 2105 1106 bar107 1/1108 >109 OUTPUT110 tmux.until { assert_block(expected, it) }111 tmux.send_keys :Space112 expected = <<~OUTPUT113 > 3114 2115 1116 1117 2118 3119 4120 1/1121 >122 OUTPUT123 tmux.until { assert_block(expected, it) }124 end125126 def test_reload_and_change_cache127 tmux.send_keys "echo bar | #{FZF} --bind 'zero:change-header(foo)+reload(echo foo)+clear-query'", :Enter128 expected = <<~OUTPUT129 > bar130 1/1131 >132 OUTPUT133 tmux.until { assert_block(expected, it) }134 tmux.send_keys :z135 expected = <<~OUTPUT136 > foo137 foo138 1/1139 >140 OUTPUT141 tmux.until { assert_block(expected, it) }142 end143144 def test_toggle_header145 tmux.send_keys "seq 4 | #{FZF} --header-lines 2 --header foo --bind space:toggle-header --header-first --height 10 --border rounded", :Enter146 before = <<~OUTPUT147 ╭───────148 │149 │ 4150 │ > 3151 │ 2152 │ 1153 │ 2/2154 │ >155 │ foo156 ╰───────157 OUTPUT158 tmux.until { assert_block(before, it) }159 tmux.send_keys :Space160 after = <<~OUTPUT161 ╭───────162 │163 │164 │165 │166 │ 4167 │ > 3168 │ 2/2169 │ >170 ╰───────171 OUTPUT172 tmux.until { assert_block(after, it) }173 tmux.send_keys :Space174 tmux.until { assert_block(before, it) }175 end176177 def test_height_range_fit178 tmux.send_keys 'seq 3 | fzf --height ~100% --info=inline --border rounded', :Enter179 expected = <<~OUTPUT180 ╭──────────181 │ ▌ 3182 │ ▌ 2183 │ > 1184 │ > < 3/3185 ╰──────────186 OUTPUT187 tmux.until { assert_block(expected, it) }188 end189190 def test_height_range_fit_preview_above191 tmux.send_keys 'seq 3 | fzf --height ~100% --info=inline --border rounded --preview-window border-rounded --preview "seq {}" --preview-window up,60%', :Enter192 expected = <<~OUTPUT193 ╭──────────194 │ ╭────────195 │ │ 1196 │ │197 │ │198 │ │199 │ ╰────────200 │ ▌ 3201 │ ▌ 2202 │ > 1203 │ > < 3/3204 ╰──────────205 OUTPUT206 tmux.until { assert_block(expected, it) }207 end208209 def test_height_range_fit_preview_above_alternative210 tmux.send_keys 'seq 3 | fzf --height ~100% --border=sharp --preview "seq {}" --preview-window up,40%,border-bottom --padding 1 --exit-0 --header hello --header-lines=2', :Enter211 expected = <<~OUTPUT212 ┌─────────213 │214 │ 1215 │ 2216 │ 3217 │ ───────218 │ > 3219 │ 2220 │ 1221 │ hello222 │ 1/1 ─223 │ >224 │225 └─────────226 OUTPUT227 tmux.until { assert_block(expected, it) }228 end229230 def test_height_range_fit_preview_left231 tmux.send_keys "seq 3 | fzf --height ~100% --border=vertical --preview 'seq {}' --preview-window left,5,border-right --padding 1 --exit-0 --header $'hello\\nworld' --header-lines=2", :Enter232 expected = <<~OUTPUT233 │234 │ 1 │ > 3235 │ 2 │ 2236 │ 3 │ 1237 │ │ hello238 │ │ world239 │ │ 1/1 ─240 │ │ >241 │242 OUTPUT243 tmux.until { assert_block(expected, it) }244 end245

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 246–250why, one step back
246 def test_preview_window_next_reverse
247 # https://github.com/junegunn/fzf/issues/4798248 tmux.send_keys %(seq 5 | #{FZF} --layout=reverse --preview 'echo PREVIEW' --preview-window=next:3 --prompt='line2$ > '), :Enter249 expected = <<~OUTPUT250 line2$ >

Hide separator next to preview window at 'next' position when decidableJunegunn Choibefore adoptione58c5e6

line 251why, one step back
251 5/5

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 252–270why, one step back
252 ╭────────
253 │ PREVIEW254 │255 │256 ╰────────257 > 1258 OUTPUT259 tmux.until { assert_block(expected, it) }260 end261262 def test_preview_window_next_default263 tmux.send_keys %(seq 5 | #{FZF} --preview 'echo PREVIEW' --preview-window=next:3), :Enter264 expected = <<~OUTPUT265 > 1266 ╭────────267 │ PREVIEW268 │269 │270 ╰────────

Hide separator next to preview window at 'next' position when decidableJunegunn Choibefore adoptione58c5e6

line 271why, one step back
271 5/5

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 272–329why, one step back
272 >
273 OUTPUT274 tmux.until { assert_block(expected, it) }275 end276277 def test_preview_window_next_border_line_at_runtime278 # change-preview-window to next,border-line should resolve BorderLine279 # to a single horizontal separator, matching the behavior280 # when next,border-line is the initial spec.281 tmux.send_keys %(seq 5 | #{FZF} --preview 'echo PREVIEW' --bind 'space:change-preview-window:next:3,border-line'), :Enter282 tmux.until { |lines| assert_equal 5, lines.match_count }283 tmux.send_keys :Space284 expected = <<~OUTPUT285 > 1286 ───────287 PREVIEW288 OUTPUT289 tmux.until do |lines|290 cursor = lines.index { it.start_with?('> 1') }291 assert(cursor)292 assert_block(expected, lines[cursor..])293 end294 end295296 def test_header_first_change_header_at_runtime297 # --header-first with no initial --header content needs to grow a298 # header window when change-header adds content at runtime, so the299 # new header lands below the prompt (not on top of it).300 tmux.send_keys %(seq 5 | #{FZF} --header-first --bind 'space:change-header:foo'), :Enter301 tmux.until { |lines| assert_equal 5, lines.match_count }302 tmux.send_keys :Space303 expected = <<~OUTPUT304 >305 foo306 OUTPUT307 tmux.until do |lines|308 prompt = lines.index { it.start_with?('>') }309 assert(prompt)310 assert_block(expected, lines[prompt..])311 end312 end313314 def test_preview_window_next_style_full_line315 tmux.send_keys %(seq 5 | #{FZF} --reverse --preview 'echo PREVIEW' --preview-window=next:3 --header foo --footer bar --style full:line), :Enter316 expected = <<~OUTPUT317 >318 ───────319 PREVIEW320321322 ───────323 foo324 ───────325 > 1326 OUTPUT327 tmux.until { assert_block(expected, it) }328 end329

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 330–599why, one step back
330 def test_height_range_overflow
331 tmux.send_keys 'seq 100 | fzf --height ~5 --info=inline --border rounded', :Enter332 expected = <<~OUTPUT333 ╭──────────────334 │ ▌ 2335 │ > 1336 │ > < 100/100337 ╰──────────────338 OUTPUT339 tmux.until { assert_block(expected, it) }340 end341342 def test_no_extra_newline_issue_3209343 tmux.send_keys(%(seq 100 | #{FZF} --height 10 --preview-window up,wrap,border-rounded --preview 'printf "─%.0s" $(seq 1 "$((FZF_PREVIEW_COLUMNS - 5))"); printf $"\\e[7m%s\\e[0m" title; echo; echo something'), :Enter)344 expected = <<~OUTPUT345 ╭──────────346 │ ─────────347 │ something348 │349 ╰──────────350 3351 2352 > 1353 100/100 ─354 >355 OUTPUT356 tmux.until { assert_block(expected, it) }357 end358359 def test_fzf_multi_line360 tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded], :Enter361 block = <<~BLOCK362 │ ▌┃998363 │ ▌┃999364 │ ▌┃1000365 │ ▌╹366 │ ▌╻1367 │ ▌╹2368 │ >>0369 │ 3/3 (3)370 │ >371 ╰───────────372 BLOCK373 tmux.until { assert_block(block, it) }374 tmux.send_keys :Up, :Up375 block = <<~BLOCK376 ╭───────377 │ >╻1378 │ >┃2379 │ >┃3380 BLOCK381 tmux.until { assert_block(block, it) }382383 block = <<~BLOCK384 │ >┃385 │386 │ >387 ╰───388 BLOCK389 tmux.until { assert_block(block, it) }390 end391392 def test_fzf_multi_line_reverse393 tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded --reverse], :Enter394 block = <<~BLOCK395 ╭───────────396 │ >397 │ 3/3 (3)398 │ >>0399 │ ▌╻1400 │ ▌╹2401 │ ▌╻1402 │ ▌┃2403 │ ▌┃3404 BLOCK405 tmux.until { assert_block(block, it) }406 end407408 def test_fzf_multi_line_no_pointer_and_marker409 tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded --reverse --pointer '' --marker '' --marker-multi-line ''], :Enter410 block = <<~BLOCK411 ╭───────────412 │ >413 │ 3/3 (3)414 │ 0415 │ 1416 │ 2417 │ 1418 │ 2419 │ 3420 BLOCK421 tmux.until { assert_block(block, it) }422 end423424 def test_gap425 tmux.send_keys %(seq 100 | #{FZF} --gap --border rounded --reverse), :Enter426 block = <<~BLOCK427 ╭─────────────────428 │ >429 │ 100/100 ──────430 │ > 1431 │ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈432 │ 2433 │ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈434 │ 3435 │ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈436 │ 4437 BLOCK438 tmux.until { assert_block(block, it) }439 end440441 def test_gap_2442 tmux.send_keys %(seq 100 | #{FZF} --gap=2 --gap-line xyz --border rounded --reverse), :Enter443 block = <<~BLOCK444 ╭─────────────────445 │ >446 │ 100/100 ──────447 │ > 1448 │449 │ xyzxyzxyzxyzxy450 │ 2451 │452 │ xyzxyzxyzxyzxy453 │ 3454 BLOCK455 tmux.until { assert_block(block, it) }456 end457458 def test_list_border_and_label459 tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --query 1 --padding 1,2), :Enter460 block = <<~BLOCK461 │ ║ 11462 │ ║ > 10463 │ ║ 3464 │ ║ 2465 │ ║ 1466 │ ║ 19/97 ─467 │ ║ > 1468 │ ╚list══════469 │470 ╰──────────────471 BLOCK472 tmux.until { assert_block(block, it) }473 end474475 def test_input_border_and_label476 tmux.send_keys %(seq 100 | #{FZF} --border rounded --input-border bold --input-label input --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2), :Enter477 block = <<~BLOCK478 │ 11479 │ > 10480 │ 3481 │ 2482 │ 1483 │ ┏input━━━━━484 │ ┃ 19/97485 │ ┃ > 1486 │ ┗━━━━━━━━━━487 │488 ╰──────────────489 BLOCK490 tmux.until { assert_block(block, it) }491 end492493 def test_input_border_and_label_header_first494 tmux.send_keys %(seq 100 | #{FZF} --border rounded --input-border bold --input-label input --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 --header-first), :Enter495 block = <<~BLOCK496 │ 11497 │ > 10498 │ ┏input━━━━━499 │ ┃ 19/97500 │ ┃ > 1501 │ ┗━━━━━━━━━━502 │ 3503 │ 2504 │ 1505 │506 ╰──────────────507 BLOCK508 tmux.until { assert_block(block, it) }509 end510511 def test_list_input_border_and_label512 tmux.send_keys %(513 seq 100 | #{FZF} --border rounded --list-border double --input-border bold --list-label-pos 2:bottom --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 \514 --bind 'start:transform-input-label(echo INPUT)+transform-list-label(echo LIST)' \515 --bind 'space:change-input-label( input )+change-list-label( list )'516 ).strip, :Enter517 block = <<~BLOCK518 │ ║ 11519 │ ║ > 10520 │ ╚LIST══════521 │ 3522 │ 2523 │ 1524 │ ┏INPUT━━━━━525 │ ┃ 19/97526 │ ┃ > 1527 │ ┗━━━━━━━━━━528 │529 ╰──────────────530 BLOCK531 tmux.until { assert_block(block, it) }532 tmux.send_keys :Space533 block = <<~BLOCK534 │ ║ 11535 │ ║ > 10536 │ ╚ list ════537 │ 3538 │ 2539 │ 1540 │ ┏ input ━━━541 │ ┃ 19/97542 │ ┃ > 1543 │ ┗━━━━━━━━━━544 │545 ╰──────────────546 BLOCK547 tmux.until { assert_block(block, it) }548 end549550 def test_list_input_border_and_label_header_first551 tmux.send_keys %(552 seq 100 | #{FZF} --border rounded --list-border double --input-border bold --list-label-pos 2:bottom --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 \553 --bind 'start:transform-input-label(echo INPUT)+transform-list-label(echo LIST)' \554 --bind 'space:change-input-label( input )+change-list-label( list )' --header-first555 ).strip, :Enter556 block = <<~BLOCK557 │ ║ 11558 │ ║ > 10559 │ ╚LIST══════560 │ ┏INPUT━━━━━561 │ ┃ 19/97562 │ ┃ > 1563 │ ┗━━━━━━━━━━564 │ 3565 │ 2566 │ 1567 │568 ╰──────────────569 BLOCK570 tmux.until { assert_block(block, it) }571 tmux.send_keys :Space572 block = <<~BLOCK573 │ ║ 11574 │ ║ > 10575 │ ╚ list ════576 │ ┏ input ━━━577 │ ┃ 19/97578 │ ┃ > 1579 │ ┗━━━━━━━━━━580 │ 3581 │ 2582 │ 1583 │584 ╰──────────────585 BLOCK586 tmux.until { assert_block(block, it) }587 end588589 def test_header_border_and_label590 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), :Enter591 block = <<~BLOCK592 │ 12593 │ 11594 │ > 10595 │ ┌────────596 │ │ 3597 │ │ 2598 │ │ 1599 │ └header──

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 600why, one step back
600 │ 19/97

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 601–630why, one step back
601 │ > 1
602 │603 ╰────────────604 BLOCK605 tmux.until { assert_block(block, it) }606 end607608 def test_header_border_toggle609 tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()'), :Enter610 block1 = <<~BLOCK611 │ 5612 │ 4613 │ 3614 │ 2615 │ > 1616 │ 100/100 ─617 │ >618 ╰────────────619 BLOCK620 tmux.until { assert_block(block1, it) }621622 tmux.send_keys :Space623 block2 = <<~BLOCK624 │ 3625 │ 2626 │ > 1627 ╰────────────628 ╭────────────629 │ hello630 ╰────────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 631why, one step back
631 100/100

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 632–650why, one step back
632 >
633 BLOCK634 tmux.until { assert_block(block2, it) }635636 tmux.send_keys :Enter637 tmux.until { assert_block(block1, it) }638 end639640 def test_header_border_toggle_with_header_lines641 tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header-border rounded --bind 'space:change-header(hello),enter:change-header()' --header-lines 2), :Enter642 block1 = <<~BLOCK643 │ 5644 │ 4645 │ > 3646 ╰──────────647 ╭──────────648 │ 2649 │ 1650 ╰──────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 651why, one step back
651 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 652–665why, one step back
652 >
653 BLOCK654 tmux.until { assert_block(block1, it) }655656 tmux.send_keys :Space657 block2 = <<~BLOCK658 │ 4659 │ > 3660 ╰──────────661 ╭──────────662 │ 2663 │ 1664 │ hello665 ╰──────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 666why, one step back
666 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 667–681why, one step back
667 >
668 BLOCK669 tmux.until { assert_block(block2, it) }670671 tmux.send_keys :Enter672 tmux.until { assert_block(block1, it) }673 end674675 def test_header_border_toggle_with_header_lines_header_first676 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), :Enter677 block1 = <<~BLOCK678 │ 5679 │ 4680 │ > 3681 ╰──────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 682why, one step back
682 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 683–720why, one step back
683 >
684 ╭──────────685 │ 2686 │ 1687 ╰──────────688 BLOCK689 tmux.until { assert_block(block1, it) }690691 tmux.send_keys :Space692 block2 = <<~BLOCK693 │ 4694 │ > 3695 ╰──────────696 2697 1698 98/98 ─699 >700 ╭──────────701 │ hello702 ╰──────────703 BLOCK704 tmux.until { assert_block(block2, it) }705706 tmux.send_keys :Enter707 tmux.until { assert_block(block1, it) }708 end709710 def test_header_border_toggle_with_header_lines_header_lines_border711 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), :Enter712 block1 = <<~BLOCK713 │ 5714 │ 4715 │ > 3716 ╰──────────717 ╔══════════718 ║ 2719 ║ 1720 ╚══════════

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 721why, one step back
721 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 722–736why, one step back
722 >
723 BLOCK724 tmux.until { assert_block(block1, it) }725726 tmux.send_keys :Space727 block2 = <<~BLOCK728 │ > 3729 ╰──────────730 ╔══════════731 ║ 2732 ║ 1733 ╚══════════734 ╭──────────735 │ hello736 ╰──────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 737why, one step back
737 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 738–752why, one step back
738 >
739 BLOCK740 tmux.until { assert_block(block2, it) }741742 tmux.send_keys :Enter743 tmux.until { assert_block(block1, it) }744 end745746 def test_header_border_toggle_with_header_lines_header_first_header_lines_border747 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), :Enter748 block1 = <<~BLOCK749 │ 5750 │ 4751 │ > 3752 ╰──────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 753why, one step back
753 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 754–769why, one step back
754 >
755 ╔══════════756 ║ 2757 ║ 1758 ╚══════════759 BLOCK760 tmux.until { assert_block(block1, it) }761762 tmux.send_keys :Space763 block2 = <<~BLOCK764 │ > 3765 ╰──────────766 ╔══════════767 ║ 2768 ║ 1769 ╚══════════

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 770why, one step back
770 98/98

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 771–812why, one step back
771 >
772 ╭──────────773 │ hello774 ╰──────────775 BLOCK776 tmux.until { assert_block(block2, it) }777778 tmux.send_keys :Enter779 tmux.until { assert_block(block1, it) }780 end781782 def test_header_border_and_label_header_first783 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), :Enter784 block = <<~BLOCK785 │ 12786 │ 11787 │ > 10788 │ 19/97 ─789 │ > 1790 │ ┌────────791 │ │ 3792 │ │ 2793 │ │ 1794 │ └header──795 │796 ╰────────────797 BLOCK798 tmux.until { assert_block(block, it) }799 end800801 def test_header_border_and_label_with_list_border802 tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2), :Enter803 block = <<~BLOCK804 │ ║ 12805 │ ║ 11806 │ ║ > 10807 │ ╚list══════808 │ ┌──────────809 │ │ 3810 │ │ 2811 │ │ 1812 │ └header────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 813why, one step back
813 │ 19/97

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 814–827why, one step back
814 │ > 1
815 │816 ╰──────────────817 BLOCK818 tmux.until { assert_block(block, it) }819 end820821 def test_header_border_and_label_with_list_border_header_first822 tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --header-first), :Enter823 block = <<~BLOCK824 │ ║ 12825 │ ║ 11826 │ ║ > 10827 │ ╚list══════

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 828why, one step back
828 │ 19/97

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 829–884why, one step back
829 │ > 1
830 │ ┌──────────831 │ │ 3832 │ │ 2833 │ │ 1834 │ └header────835 │836 ╰──────────────837 BLOCK838 tmux.until { assert_block(block, it) }839 end840841 def test_all_borders842 tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --input-border bold --input-label input --input-label-pos 2:bottom), :Enter843 block = <<~BLOCK844 │ ║ 12845 │ ║ 11846 │ ║ > 10847 │ ╚list══════848 │ ┌──────────849 │ │ 3850 │ │ 2851 │ │ 1852 │ └header────853 │ ┏━━━━━━━━━━854 │ ┃ 19/97855 │ ┃ > 1856 │ ┗input━━━━━857 │858 ╰──────────────859 BLOCK860 tmux.until { assert_block(block, it) }861 end862863 def test_all_borders_header_first864 tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --input-border bold --input-label input --input-label-pos 2:bottom --header-first), :Enter865 block = <<~BLOCK866 │ ║ 12867 │ ║ 11868 │ ║ > 10869 │ ╚list══════870 │ ┏━━━━━━━━━━871 │ ┃ 19/97872 │ ┃ > 1873 │ ┗input━━━━━874 │ ┌──────────875 │ │ 3876 │ │ 2877 │ │ 1878 │ └header────879 │880 ╰──────────────881 BLOCK882 tmux.until { assert_block(block, it) }883 end884

Fix adaptive height with an inline header or footer borderJunegunn Choibefore adoption1372d04

lines 885–906why, one step back
885 def test_adaptive_height_with_inline_sections
886 tmux.send_keys %(seq 10 | #{FZF} --height=~100% --list-border --header-lines=1 --header-lines-border=inline), :Enter887 block = <<~BLOCK888 ╭──────889 │ 10890 │ 9891 │ 8892 │ 7893 │ 6894 │ 5895 │ 4896 │ 3897 │ > 2898 ├──────899 │ 1900 ╰──────901 9/9902 >903 BLOCK904 tmux.until { assert_block(block, it) }905 end906

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 907–1063why, one step back
907 def test_style_full_adaptive_height
908 tmux.send_keys %(seq 1| #{FZF} --style=full:rounded --height=~100% --header-lines=1 --info=default), :Enter909 block = <<~BLOCK910 ╭────────911 ╰────────912 ╭────────913 │ 1914 ╰────────915 ╭────────916 │ 0/0917 │ >918 ╰────────919 BLOCK920 tmux.until { assert_block(block, it) }921 end922923 def test_style_full_adaptive_height_double924 tmux.send_keys %(seq 1| #{FZF} --style=full:double --border --height=~100% --header-lines=1 --info=default), :Enter925 block = <<~BLOCK926 ╔══════════927 ║ ╔════════928 ║ ╚════════929 ║ ╔════════930 ║ ║ 1931 ║ ╚════════932 ║ ╔════════933 ║ ║ 0/0934 ║ ║ >935 ║ ╚════════936 ╚══════════937 BLOCK938 tmux.until { assert_block(block, it) }939 end940941 def test_preview_window_noinfo942 # │ 1 ││943 tmux.send_keys %(#{FZF} --preview 'seq 1000' --preview-window top,noinfo --scrollbar --bind space:change-preview-window:info), :Enter944 tmux.until do |lines|945 assert lines[1]&.start_with?('│ 1')946 assert lines[1]&.end_with?(' ││')947 end948 tmux.send_keys :Space949 tmux.until do |lines|950 assert lines[1]&.start_with?('│ 1')951 assert lines[1]&.end_with?('1000││')952 end953 end954955 def test_min_height_no_auto956 tmux.send_keys %(seq 100 | #{FZF} --border sharp --style full:sharp --height 1% --min-height 5), :Enter957958 block = <<~BLOCK959 ┌───────960 │ ┌─────961 │ │ >962 │ └─────963 └───────964 BLOCK965 tmux.until { assert_block(block, it) }966 end967968 def test_min_height_auto969 tmux.send_keys %(seq 100 | #{FZF} --style full:sharp --height 1% --min-height 5+), :Enter970971 block = <<~BLOCK972 ┌─────────973 │ 5974 │ 4975 │ 3976 │ 2977 │ > 1978 └─────────979 ┌─────────980 │ >981 └─────────982 BLOCK983 tmux.until { assert_block(block, it) }984 end985986 def test_min_height_auto_no_input987 tmux.send_keys %(seq 100 | #{FZF} --style full:sharp --no-input --height 1% --min-height 5+), :Enter988989 block = <<~BLOCK990 ┌─────────991 │ 5992 │ 4993 │ 3994 │ 2995 │ > 1996 └─────────997 BLOCK998 tmux.until { assert_block(block, it) }999 end10001001 def test_min_height_auto_no_input_reverse_list1002 tmux.send_keys %(seq 100 | #{FZF} --style full:sharp --layout reverse-list --no-input --height 1% --min-height 5+ --bind a:show-input,b:hide-input,c:toggle-input), :Enter10031004 block = <<~BLOCK1005 ┌─────────1006 │ > 11007 │ 21008 │ 31009 │ 41010 │ 51011 └─────────1012 BLOCK1013 tmux.until { assert_block(block, it) }1014 tmux.send_keys :a1015 block2 = <<~BLOCK1016 ┌─────1017 │ > 11018 │ 21019 └─────1020 ┌─────1021 │ >1022 └─────1023 BLOCK1024 tmux.until { assert_block(block2, it) }1025 tmux.send_keys :b1026 tmux.until { assert_block(block, it) }1027 tmux.send_keys :c1028 tmux.until { assert_block(block2, it) }1029 tmux.send_keys :c1030 tmux.until { assert_block(block, it) }1031 end10321033 def test_layout_reverse_list1034 prefix = "seq 5 | #{FZF} --layout reverse-list --no-list-border --height ~100% --border sharp "1035 suffixes = [1036 %(),1037 %[--header "$(seq 101 103)"],1038 %[--header "$(seq 101 103)" --header-first],1039 %[--header "$(seq 101 103)" --header-lines 3],1040 %[--header "$(seq 101 103)" --header-lines 3 --header-first],1041 %[--header "$(seq 101 103)" --header-border sharp],1042 %[--header "$(seq 101 103)" --header-border sharp --header-first],1043 %[--header "$(seq 101 103)" --header-border sharp --header-lines 3],1044 %[--header "$(seq 101 103)" --header-border sharp --header-lines 3 --header-lines-border sharp],1045 %[--header "$(seq 101 103)" --header-border sharp --header-lines 3 --header-lines-border sharp --header-first],1046 %[--header "$(seq 101 103)" --header-border sharp --header-lines 3 --header-lines-border sharp --header-first --input-border sharp],1047 %[--header "$(seq 101 103)" --header-border sharp --header-lines 3 --header-lines-border sharp --header-first --no-input],1048 %[--header "$(seq 101 103)" --input-border sharp],1049 %[--header "$(seq 101 103)" --style full:sharp],1050 %[--header "$(seq 101 103)" --style full:sharp --header-first]1051 ]1052 output = <<~BLOCK1053 ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌───────── ┌─────── ┌───────── ┌───────── ┌─────────1054 │ > 1 │ > 1 │ > 1 │ 1 │ 1 │ > 1 │ > 1 │ 1 │ ┌────── │ ┌────── │ ┌─────── │ ┌───── │ > 1 │ ┌─────── │ ┌───────1055 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ │ 1 │ │ 1 │ │ 1 │ │ 1 │ 2 │ │ > 1 │ │ > 11056 │ 3 │ 3 │ 3 │ 3 │ 3 │ 3 │ 3 │ 3 │ │ 2 │ │ 2 │ │ 2 │ │ 2 │ 3 │ │ 2 │ │ 21057 │ 4 │ 4 │ 4 │ > 4 │ > 4 │ 4 │ 4 │ > 4 │ │ 3 │ │ 3 │ │ 3 │ │ 3 │ 4 │ │ 3 │ │ 31058 │ 5 │ 5 │ 5 │ 5 │ 5 │ 5 │ 5 │ 5 │ └────── │ └────── │ └─────── │ └───── │ 5 │ │ 4 │ │ 41059 │ 5/5 ─ │ 101 │ 5/5 ─ │ 101 │ 2/2 ─ │ ┌────── │ 5/5 ─ │ ┌────── │ > 4 │ > 4 │ > 4 │ > 4 │ 101 │ │ 5 │ │ 51060 │ > │ 102 │ > │ 102 │ > │ │ 101 │ > │ │ 101 │ 5 │ 5 │ 5 │ 5 │ 102 │ └─────── │ └───────1061 └──────── │ 103 │ 101 │ 103 │ 101 │ │ 102 │ ┌────── │ │ 102 │ ┌────── │ 2/2 ─ │ ┌─────── │ ┌───── │ 103 │ ┌─────── │ ┌───────1062 │ 5/5 ─ │ 102 │ 2/2 ─ │ 102 │ │ 103 │ │ 101 │ │ 103 │ │ 101 │ > │ │ 2/2 │ │ 101 │ ┌─────── │ │ 101 │ │ >1063 │ > │ 103 │ > │ 103 │ └────── │ │ 102 │ └────── │ │ 102 │ ┌────── │ │ > │ │ 102 │ │ 5/5 │ │ 102 │ └───────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1064why, one step back
1064 └──────── └──────── └──────── └──────── │ 5/5 │ │ 103 │ 2/2 │ │ 103 │ │ 101 │ └─────── │ │ 103 │ │ > │ │ 103 │ ┌───────

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1065why, one step back
1065 │ > │ └────── │ > │ └────── │ │ 102 │ ┌─────── │ └───── │ └─────── │ └─────── │ │ 101

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1066why, one step back
1066 └──────── └──────── └──────── │ 2/2 │ │ 103 │ │ 101 └─────── └───────── │ ┌─────── │ │ 102

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1067–1123why, one step back
1067 │ > │ └────── │ │ 102 │ │ > │ │ 103
1068 └──────── └──────── │ │ 103 │ └─────── │ └───────1069 │ └─────── └───────── └─────────1070 └─────────1071 BLOCK10721073 expects = []1074 output.each_line.first.scan(/\S+/) do1075 offset = Regexp.last_match.offset(0)1076 expects << output.lines.filter_map { it[offset[0]...offset[1]]&.strip }.take_while { !it.empty? }.join("\n")1077 end10781079 suffixes.zip(expects).each do |suffix, block|1080 tmux.send_keys(prefix + suffix, :Enter)1081 tmux.until { assert_block(block, it) }10821083 teardown1084 setup1085 end1086 end10871088 def test_layout_default_with_footer1089 prefix = %[1090 seq 3 | #{FZF} --no-list-border --height ~100% \1091 --border sharp --footer "$(seq 201 202)" --footer-label FOOT --footer-label-pos 3 \1092 --header-label HEAD --header-label-pos 3:bottom \1093 --bind 'space:transform-footer-label(echo foot)+change-header-label(head)'1094 ].strip + ' '1095 suffixes = [1096 %(),1097 %[--header "$(seq 101 102)"],1098 %[--header "$(seq 101 102)" --header-first],1099 %[--header "$(seq 101 102)" --header-lines 2],1100 %[--header "$(seq 101 102)" --header-lines 2 --header-first],1101 %[--header "$(seq 101 102)" --header-border sharp],1102 %[--header "$(seq 101 102)" --header-border sharp --header-first],1103 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2],1104 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --no-header-lines-border],1105 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border none],1106 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp],1107 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --input-border sharp],1108 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --no-input],1109 %[--header "$(seq 101 102)" --footer-border sharp --input-border line],1110 %[--header "$(seq 101 102)" --style full:sharp --header-first]1111 ]1112 output = <<~BLOCK1113 ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌───────── ┌──────── ┌──────── ┌─────────1114 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ ┌─FOOT─ │ ┌─FOOT──1115 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ │ 201 │ │ 2011116 │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT── │ ──FOOT─ │ │ 202 │ │ 2021117 │ 3 │ 3 │ 3 │ > 3 │ > 3 │ 3 │ 3 │ > 3 │ > 3 │ > 3 │ > 3 │ > 3 │ > 3 │ └────── │ └───────1118 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ ┌────── │ ┌────── │ 2 │ ┌────── │ ┌─────── │ ┌────── │ 3 │ ┌───────1119 │ > 1 │ > 1 │ > 1 │ 1 │ 1 │ > 1 │ > 1 │ │ 2 │ │ 2 │ 1 │ │ 2 │ │ 2 │ │ 2 │ 2 │ │ 31120 │ 3/3 ─ │ 101 │ 3/3 ─ │ 101 │ 1/1 ─ │ ┌────── │ 3/3 ─ │ │ 1 │ │ 1 │ ┌────── │ │ 1 │ │ 1 │ │ 1 │ > 1 │ │ 21121 │ > │ 102 │ > │ 102 │ > │ │ 101 │ > │ │ 101 │ │ 101 │ │ 101 │ └────── │ └─────── │ └────── │ 101 │ │ > 11122 └──────── │ 3/3 ─ │ 101 │ 1/1 ─ │ 101 │ │ 102 │ ┌────── │ │ 102 │ │ 102 │ │ 102 │ ┌────── │ ┌─────── │ ┌────── │ 102 │ └───────1123 │ > │ 102 │ > │ 102 │ └─HEAD─ │ │ 101 │ └─HEAD─ │ └─HEAD─ │ └─HEAD─ │ │ 101 │ │ 1/1 │ │ 101 │ ─────── │ ┌───────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1124why, one step back
1124 └──────── └──────── └──────── └──────── │ 3/3 │ │ 102 │ 1/1 │ 1/1 │ 1/1 │ │ 102 │ │ > │ │ 102 │ 3/3 │ │ >

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1125why, one step back
1125 │ > │ └─HEAD─ │ > │ > │ > │ └─HEAD─ │ └─────── │ └─HEAD─ │ > │ └───────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1126why, one step back
1126 └──────── └──────── └──────── └──────── └──────── │ 1/1 │ ┌─────── └──────── └──────── │ ┌───────

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1127–1183why, one step back
1127 │ > │ │ 101 │ │ 101
1128 └──────── │ │ 102 │ │ 1021129 │ └─HEAD── │ └─HEAD──1130 └───────── └─────────1131 BLOCK11321133 expects = []1134 output.each_line.first.scan(/\S+/) do1135 offset = Regexp.last_match.offset(0)1136 expects << output.lines.filter_map { it[offset[0]...offset[1]]&.strip }.take_while { !it.empty? }.join("\n")1137 end11381139 suffixes.zip(expects).each do |suffix, block|1140 tmux.send_keys(prefix + suffix, :Enter)1141 tmux.until { assert_block(block, it) }1142 tmux.send_keys :Space1143 tmux.until { assert_block(block.downcase, it) }11441145 teardown1146 setup1147 end1148 end11491150 def test_layout_reverse_list_with_footer1151 prefix = %[1152 seq 3 | #{FZF} --layout reverse-list --no-list-border --height ~100% \1153 --border sharp --footer "$(seq 201 202)" --footer-label FOOT --footer-label-pos 3 \1154 --header-label HEAD --header-label-pos 3:bottom \1155 --bind 'space:transform-footer-label(echo foot)+change-header-label(head)'1156 ].strip + ' '1157 suffixes = [1158 %(),1159 %[--header "$(seq 101 102)"],1160 %[--header "$(seq 101 102)" --header-first],1161 %[--header "$(seq 101 102)" --header-lines 2],1162 %[--header "$(seq 101 102)" --header-lines 2 --header-first],1163 %[--header "$(seq 101 102)" --header-border sharp],1164 %[--header "$(seq 101 102)" --header-border sharp --header-first],1165 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2],1166 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp],1167 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --input-border sharp],1168 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --no-input],1169 %[--header "$(seq 101 102)" --footer-border sharp --input-border line],1170 %[--header "$(seq 101 102)" --style full:sharp --header-first]1171 ]1172 output = <<~BLOCK1173 ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌───────── ┌──────── ┌──────── ┌─────────1174 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ ┌─FOOT─ │ ┌─FOOT──1175 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ │ 201 │ │ 2011176 │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT── │ ──FOOT─ │ │ 202 │ │ 2021177 │ > 1 │ > 1 │ > 1 │ 1 │ 1 │ > 1 │ > 1 │ 1 │ ┌────── │ ┌─────── │ ┌────── │ └────── │ └───────1178 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ │ 1 │ │ 1 │ │ 1 │ > 1 │ ┌───────1179 │ 3 │ 3 │ 3 │ > 3 │ > 3 │ 3 │ 3 │ > 3 │ │ 2 │ │ 2 │ │ 2 │ 2 │ │ > 11180 │ 3/3 ─ │ 101 │ 3/3 ─ │ 101 │ 1/1 ─ │ ┌────── │ 3/3 ─ │ ┌────── │ └────── │ └─────── │ └────── │ 3 │ │ 21181 │ > │ 102 │ > │ 102 │ > │ │ 101 │ > │ │ 101 │ > 3 │ > 3 │ > 3 │ 101 │ │ 31182 └──────── │ 3/3 ─ │ 101 │ 1/1 ─ │ 101 │ │ 102 │ ┌────── │ │ 102 │ ┌────── │ ┌─────── │ ┌────── │ 102 │ └───────1183 │ > │ 102 │ > │ 102 │ └─HEAD─ │ │ 101 │ └─HEAD─ │ │ 101 │ │ 1/1 │ │ 101 │ ─────── │ ┌───────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1184why, one step back
1184 └──────── └──────── └──────── └──────── │ 3/3 │ │ 102 │ 1/1 │ │ 102 │ │ > │ │ 102 │ 3/3 │ │ >

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1185why, one step back
1185 │ > │ └─HEAD─ │ > │ └─HEAD─ │ └─────── │ └─HEAD─ │ > │ └───────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1186why, one step back
1186 └──────── └──────── └──────── │ 1/1 │ ┌─────── └──────── └──────── │ ┌───────

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1187–1215why, one step back
1187 │ > │ │ 101 │ │ 101
1188 └──────── │ │ 102 │ │ 1021189 │ └─HEAD── │ └─HEAD──1190 └───────── └─────────1191 BLOCK11921193 expects = []1194 output.each_line.first.scan(/\S+/) do1195 offset = Regexp.last_match.offset(0)1196 expects << output.lines.filter_map { it[offset[0]...offset[1]]&.strip }.take_while { !it.empty? }.join("\n")1197 end11981199 suffixes.zip(expects).each do |suffix, block|1200 tmux.send_keys(prefix + suffix, :Enter)1201 tmux.until { assert_block(block, it) }1202 tmux.send_keys :Space1203 tmux.until { assert_block(block.downcase, it) }12041205 teardown1206 setup1207 end1208 end12091210 def test_change_header_and_label_at_once1211 tmux.send_keys %(seq 10 | #{FZF} --border sharp --header-border sharp --header-label-pos 3 --bind 'focus:change-header(header)+change-header-label(label)'), :Enter1212 block = <<~BLOCK1213 │ ┌─label──1214 │ │ header1215 │ └────────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1216why, one step back
1216 │ 10/10

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1217–1252why, one step back
1217 │ >
1218 └──────────1219 BLOCK1220 tmux.until { assert_block(block, it) }1221 end12221223 def test_label_truncation1224 command = <<~CMD1225 seq 10 | #{FZF} --style full --border --header-lines=1 --preview ':' \\1226 --border-label "#{'b' * 1000}" \\1227 --preview-label "#{'p' * 1000}" \\1228 --header-label "#{'h' * 1000}" \\1229 --header-label "#{'h' * 1000}" \\1230 --input-label "#{'i' * 1000}" \\1231 --list-label "#{'l' * 1000}"1232 CMD1233 writelines(command.lines.map(&:chomp))1234 tmux.send_keys("sh #{tempname}", :Enter)1235 tmux.until do |lines|1236 text = lines.join1237 assert_includes text, 'b··'1238 assert_includes text, 'l··p'1239 assert_includes text, 'p··'1240 assert_includes text, 'h··'1241 assert_includes text, 'i··'1242 end1243 end12441245 def test_separator_no_ellipsis1246 tmux.send_keys %(seq 10 | #{FZF} --separator "$(seq 1000 | tr '\\n' ' ')"), :Enter1247 tmux.until do |lines|1248 assert_equal 10, lines.match_count1249 refute_includes lines.join, '··'1250 end1251 end1252

Apply facing-line rule to input border as wellJunegunn Choibefore adoption7fe4831

lines 1253–1329why, one step back
1253 def test_separator_with_input_border
1254 # Border line below input does not face the list; separator is shown1255 tmux.send_keys %(seq 100 | #{FZF} --input-border bottom), :Enter1256 block = <<~BLOCK1257 > 11258 100/100 ──1259 >1260 ────────────1261 BLOCK1262 tmux.until { assert_block(block, it) }1263 teardown1264 setup12651266 # List border faces the input instead; separator is hidden1267 tmux.send_keys %(seq 100 | #{FZF} --input-border bottom --list-border rounded), :Enter1268 block = <<~BLOCK1269 │ > 11270 ╰────────────1271 100/1001272 >1273 ─────────────1274 BLOCK1275 tmux.until { assert_block(block, it) }1276 teardown1277 setup12781279 # Border line above input faces the list; separator is hidden1280 tmux.send_keys %(seq 100 | #{FZF} --input-border top), :Enter1281 block = <<~BLOCK1282 > 11283 ────────────1284 100/1001285 >1286 BLOCK1287 tmux.until { assert_block(block, it) }1288 end12891290 def test_separator_with_input_border_reverse1291 # Border line above input does not face the list; separator is shown1292 tmux.send_keys %(seq 100 | #{FZF} --layout reverse --input-border top), :Enter1293 block = <<~BLOCK1294 ────────────1295 >1296 100/100 ──1297 > 11298 BLOCK1299 tmux.until { assert_block(block, it) }1300 teardown1301 setup13021303 # Border line below input faces the list; separator is hidden1304 tmux.send_keys %(seq 100 | #{FZF} --layout reverse --input-border bottom), :Enter1305 block = <<~BLOCK1306 >1307 100/1001308 ────────────1309 > 11310 BLOCK1311 tmux.until { assert_block(block, it) }1312 end13131314 def test_separator_with_preview_next1315 # Preview window at 'next' position sits next to the input section, so the1316 # header border does not hide the separator1317 tmux.send_keys %(seq 100 | #{FZF} --header foo --header-border rounded --no-list-border --preview 'echo hi' --preview-window next,1,border-none), :Enter1318 block = <<~BLOCK1319 ╰────────────1320 hi1321 100/100 ───1322 >1323 BLOCK1324 tmux.until { assert_block(block, it) }1325 teardown1326 setup13271328 # Same when 'next' position comes from a threshold alternative1329 tmux.send_keys %(seq 100 | #{FZF} --header foo --header-border rounded --no-list-border --preview 'echo hi' --preview-window 'up,40%,<9999(next,1,border-none)'), :Enter

Hide separator next to preview window at 'next' position when decidableJunegunn Choibefore adoptione58c5e6

lines 1330–1489why, one step back
1330 tmux.until { assert_block(block, it) }
1331 teardown1332 setup13331334 # A border of the preview window at 'next' position facing the input1335 # section hides the separator1336 tmux.send_keys %(seq 100 | #{FZF} --preview : --preview-window next,3), :Enter1337 block = <<~BLOCK1338 ╰────────────1339 100/1001340 >1341 BLOCK1342 tmux.until { assert_block(block, it) }1343 teardown1344 setup13451346 # Same when every spec in the threshold chain is a bordered preview1347 # window at 'next' position1348 tmux.send_keys %(seq 100 | #{FZF} --preview : --preview-window 'next,3,<15(next,3)'), :Enter1349 tmux.until { assert_block(block, it) }1350 end13511352 def test_separator_with_preview_next_toggle1353 tmux.send_keys %(seq 100 | #{FZF} --preview 'echo hi' --preview-window next,3,hidden --bind space:toggle-preview), :Enter1354 hidden = <<~BLOCK1355 > 11356 100/100 ──1357 >1358 BLOCK1359 tmux.until { assert_block(hidden, it) }13601361 tmux.send_keys :Space1362 shown = <<~BLOCK1363 │ hi1364 │1365 │1366 ╰────────────1367 100/1001368 >1369 BLOCK1370 tmux.until { assert_block(shown, it) }13711372 tmux.send_keys :Space1373 tmux.until { assert_block(hidden, it) }1374 end13751376 def test_separator_with_preview_next_alternative_only1377 # 'next' appears only in a threshold alternative and there is no1378 # previewer, so the input section stays embedded in the list window and1379 # needs the separator1380 tmux.send_keys %(seq 100 | #{FZF} --preview-window '<9999(next)' --list-border rounded), :Enter1381 block = <<~BLOCK1382 │ > 11383 │ 100/100 ──1384 │ >1385 ╰─────────────1386 BLOCK1387 tmux.until { assert_block(block, it) }1388 end13891390 def test_separator_with_preview_action_at_next1391 # preview(...) action can display an ad-hoc preview window at 'next'1392 # position at any time; the list border must not hide the separator1393 tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --preview-window 'next,border-left,5' --bind 'space:preview(echo hi)'), :Enter1394 block = <<~BLOCK1395 ╰─────────────1396 100/100 ──1397 >1398 BLOCK1399 tmux.until { assert_block(block, it) }14001401 tmux.send_keys :Space1402 block = <<~BLOCK1403 │ hi1404 │1405 │1406 │1407 │1408 100/100 ──1409 >1410 BLOCK1411 tmux.until { assert_block(block, it) }1412 end14131414 def test_separator_change_preview_window_keeps_forced_preview1415 # Relayout triggered by the separator visibility change must not drop a1416 # preview window opened via the preview(...) action1417 tmux.send_keys %(seq 100 | #{FZF} --info hidden --input-border left --list-border --preview-window 'up,50%,<5(next)' --bind 'space:preview(echo AD-HOC)' --bind 'x:change-preview-window(up,50%,<5(up))'), :Enter1418 tmux.until { |lines| assert_includes lines.join, '│ ─' }14191420 tmux.send_keys :Space1421 tmux.until do |lines|1422 assert_includes lines.join, 'AD-HOC'1423 assert_includes lines.join, '│ ─'1424 end14251426 # Only the inactive threshold alternative changes; separator is hidden1427 # by the list border, and the forced preview window must survive1428 tmux.send_keys :x1429 tmux.until do |lines|1430 assert_includes lines.join, 'AD-HOC'1431 refute_includes lines.join, '│ ─'1432 end1433 end14341435 def test_separator_with_change_preview_window_chain1436 # change-preview-window that only alters a non-active spec must still1437 # trigger a relayout when it changes the separator visibility1438 tmux.send_keys %(seq 100 | #{FZF} --info hidden --layout reverse --preview 'echo hi' --preview-window 'next,3,border-none,<100(next,3,border-top)' --bind 'space:change-preview-window(next,3,border-top,<100(next,3,border-top))'), :Enter1439 block = <<~BLOCK1440 >1441 ──────────1442 ──────────1443 hi1444 BLOCK1445 tmux.until { assert_block(block, it) }14461447 tmux.send_keys :Space1448 block = <<~BLOCK1449 >1450 ──────────1451 hi1452 BLOCK1453 tmux.until { assert_block(block, it) }1454 teardown1455 setup14561457 # Also when only the drawn bar changes; the info line row count is1458 # constant with the default info style1459 tmux.send_keys %(seq 100 | #{FZF} --layout reverse --preview 'echo hi' --preview-window 'next,3,border-none,<100(next,3,border-top)' --bind 'space:change-preview-window(next,3,border-top,<100(next,3,border-top))'), :Enter1460 block = <<~BLOCK1461 >1462 100/100 ──1463 BLOCK1464 tmux.until { assert_block(block, it) }14651466 tmux.send_keys :Space1467 block = <<~BLOCK1468 >1469 100/1001470 ────────────1471 BLOCK1472 tmux.until { assert_block(block, it) }1473 teardown1474 setup14751476 # Also when compare finds a content-layout difference (scroll offset)1477 tmux.send_keys %(seq 100 | #{FZF} --info hidden --preview 'echo hi' --preview-window 'next,3,<2(up,3)' --bind 'space:change-preview-window(next,3,+1,<2(next,3))'), :Enter1478 block = <<~BLOCK1479 ╰────────────1480 ─────────────1481 >1482 BLOCK1483 tmux.until { assert_block(block, it) }14841485 tmux.send_keys :Space1486 block = <<~BLOCK1487 ╰────────────1488 >1489 BLOCK

Apply facing-line rule to input border as wellJunegunn Choibefore adoption7fe4831

lines 1490–1521why, one step back
1490 tmux.until { assert_block(block, it) }
1491 end14921493 def test_separator_with_inline_header_border1494 # Inline header is drawn inside the list border; bare header lines sit1495 # next to the input section, so the separator is shown1496 tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header foo --header-lines 2 --header-border inline --header-lines-border none), :Enter1497 block = <<~BLOCK1498 ╰────────────1499 21500 11501 98/98 ───1502 >1503 BLOCK1504 tmux.until { assert_block(block, it) }1505 teardown1506 setup15071508 # Header lines are embedded in the list border along with the inline1509 # header; the list border faces the input section and hides the separator1510 tmux.send_keys %(seq 100 | #{FZF} --list-border rounded --header foo --header-lines 2 --header-border inline), :Enter1511 block = <<~BLOCK1512 │ 21513 │ 11514 │ foo1515 ╰────────────1516 98/981517 >1518 BLOCK1519 tmux.until { assert_block(block, it) }1520 end1521

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1522–1527why, one step back
1522 def test_header_border_no_pointer_and_marker
1523 tmux.send_keys %(seq 10 | #{FZF} --header-lines 1 --header-border sharp --no-list-border --pointer '' --marker ''), :Enter1524 block = <<~BLOCK1525 ┌──────1526 │ 11527 └──────

Hide default separator when a border separates input from listJunegunn Choibefore adoption6030226

line 1528why, one step back
1528 9/9

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1529–1604why, one step back
1529 >
1530 BLOCK1531 tmux.until { assert_block(block, it) }1532 end15331534 def test_gutter_default1535 tmux.send_keys %(seq 10 | fzf), :Enter1536 block = <<~BLOCK1537 ▌ 31538 ▌ 21539 > 11540 10/101541 >1542 BLOCK1543 tmux.until { assert_block(block, it) }1544 end15451546 def test_gutter_default_no_unicode1547 tmux.send_keys %(seq 10 | fzf --no-unicode), :Enter1548 block = <<~BLOCK1549 31550 21551 > 11552 10/101553 >1554 BLOCK1555 tmux.until { assert_block(block, it) }1556 end15571558 def test_gutter_custom1559 tmux.send_keys %(seq 10 | fzf --gutter x), :Enter1560 block = <<~BLOCK1561 x 31562 x 21563 > 11564 10/101565 >1566 BLOCK1567 tmux.until { assert_block(block, it) }1568 end15691570 # https://github.com/junegunn/fzf/issues/45371571 def test_no_scrollbar_preview_toggle1572 x = 'x' * 3001573 y = 'y' * 3001574 tmux.send_keys %(yes #{x} | head -1000 | fzf --bind 'tab:toggle-preview' --border --no-scrollbar --preview 'echo #{y}' --preview-window 'border-left'), :Enter15751576 # │ ▌ xxxxxxxx·· │ yyyyyyyy│1577 tmux.until do |lines|1578 lines.any? { it.match?(/x·· │ y+│$/) }1579 end1580 tmux.send_keys :Tab15811582 # │ ▌ xxxxxxxx·· │1583 tmux.until do |lines|1584 lines.none? { it.match?(/x··y│$/) }1585 end15861587 tmux.send_keys :Tab1588 tmux.until do |lines|1589 lines.any? { it.match?(/x·· │ y+│$/) }1590 end1591 end15921593 def test_header_and_footer_should_not_be_wider_than_list1594 tmux.send_keys %(WIDE=$(printf 'x%.0s' {1..1000}); (echo $WIDE; echo $WIDE) | fzf --header-lines 1 --style full --header-border bottom --header-lines-border top --ellipsis XX --header "$WIDE" --footer "$WIDE" --no-footer-border), :Enter1595 tmux.until do |lines|1596 matches = lines.filter_map { |line| line[/x+XX/] }1597 assert_equal 4, matches.length1598 assert_equal 1, matches.uniq.length1599 end1600 end16011602 def test_combinations1603 skip unless ENV['LONGTEST']1604

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1605–1628why, one step back
1605 begin
1606 base = [1607 '--pointer=@',1608 '--exact',1609 '--query=123',1610 '--header="$(seq 101 103)"',1611 '--header-lines=3',1612 '--footer "$(seq 201 203)"',1613 '--preview "echo foobar"'1614 ]1615 options = [1616 ['--separator==', '--no-separator'],1617 ['--info=default', '--info=inline', '--info=inline-right'],1618 ['--no-input-border', '--input-border'],1619 ['--no-header-border', '--header-border=none', '--header-border'],1620 ['--no-header-lines-border', '--header-lines-border'],1621 ['--no-footer-border', '--footer-border'],1622 ['--no-list-border', '--list-border'],1623 ['--preview-window=right', '--preview-window=up', '--preview-window=down', '--preview-window=left', '--preview-window=next'],1624 ['--header-first', '--no-header-first'],1625 ['--layout=default', '--layout=reverse', '--layout=reverse-list']1626 ]1627 # Combination of all options1628 combinations = options[0].product(*options.drop(1))

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1629why, one step back
1629

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1630–1643why, one step back
1630 # Run workers in parallel, each with its own pre-created tmux window.
1631 # Tmux setup/teardown is serialized in the main thread to avoid racing1632 # `tmux new-window` and `tmux kill-window` calls on the tmux server.1633 workers = 101634 tmuxes = Array.new(workers) { Tmux.new }1635 failures = []1636 mutex = Mutex.new1637 queue = Queue.new1638 index = 01639 threads = tmuxes.map do |local_tmux|1640 Thread.new do1641 command = nil1642 loop do1643 combination = queue.pop or break

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1644why, one step back
1644

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1645–1653why, one step back
1645 opts = base + combination
1646 command = %(seq 1001 2000 | #{FZF} #{opts.join(' ')})1647 mutex.synchronize do1648 print("\r#{index += 1}/#{combinations.length}")1649 end1650 local_tmux.send_keys command, :Enter1651 local_tmux.until do |lines|1652 layout = combination.find { it.start_with?('--layout=') }.split('=').last1653 header_first = combination.include?('--header-first')

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1654why, one step back
1654

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1655–1657why, one step back
1655 # Input
1656 input = lines.index { it.include?('> 123') }1657 assert(input)

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1658why, one step back
1658

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1659–1661why, one step back
1659 # Info
1660 info = lines.index { it.include?('11/997') }1661 assert(info)

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1662why, one step back
1662

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

line 1663why, one step back
1663 assert(layout == 'reverse' ? input <= info : input >= info)

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1664why, one step back
1664

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1665–1668why, one step back
1665 # List
1666 item1 = lines.index { it.include?('1230') }1667 item2 = lines.index { it.include?('1231') }1668 assert_equal(item1, layout == 'default' ? item2 + 1 : item2 - 1)

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1669why, one step back
1669

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1670–1671why, one step back
1670 # Preview
1671 assert(lines.any? { it.include?('foobar') })

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1672why, one step back
1672

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1673–1695why, one step back
1673 # Header
1674 header1 = lines.index { it.include?('101') }1675 header2 = lines.index { it.include?('102') }1676 assert_equal(header2, header1 + 1)1677 assert((layout == 'reverse') == header_first ? input > header1 : input < header1)16781679 # Footer1680 footer1 = lines.index { it.include?('201') }1681 footer2 = lines.index { it.include?('202') }1682 assert_equal(footer2, footer1 + 1)1683 assert(layout == 'reverse' ? footer1 > item2 : footer1 < item2)16841685 # Header lines1686 hline1 = lines.index { it.include?('1001') }1687 hline2 = lines.index { it.include?('1002') }1688 assert_equal(hline1, layout == 'default' ? hline2 + 1 : hline2 - 1)1689 assert(layout == 'reverse' ? hline1 > header1 : hline1 < header1)1690 end1691 local_tmux.send_keys :Enter1692 end1693 rescue StandardError, Minitest::Assertion => e1694 mutex.synchronize { failures << [command, e] }1695 end

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

line 1696why, one step back
1696 end

Add --preview-window=next position (#4801)Junegunn Choibefore adoption677e854

lines 1697–1704why, one step back
1697 combinations.each { queue << it }
1698 queue.close16991700 threads.each(&:join)1701 raise failures.inspect unless failures.empty?1702 ensure1703 # Reverse so any tmux window renumbering does not leave stale indices behind.1704 tmuxes&.reverse_each(&:kill)

bash: shift-delete to delete history entries during CTRL-RJunegunn Choibefore adoption76efddd

lines 1705–1706why, one step back
1705 end
1706 end

Add test cases for click-header and click-footerJunegunn Choibefore adoptionfaa6a7e

lines 1707–1780why, one step back
1707
1708 # Locate a word in the currently captured screen and click its first character.1709 # tmux rows/columns are 1-based; capture indices are 0-based.1710 def click_word(word)1711 tmux.capture.each_with_index do |line, idx|1712 col = line.index(word)1713 return tmux.click(col + 1, idx + 1) if col1714 end1715 flunk("word #{word.inspect} not found on screen")1716 end17171718 # Launch fzf with a click-{header,footer} binding that echoes FZF_CLICK_* into the prompt,1719 # then click each word in `clicks` and assert the resulting L/W values.1720 # `clicks` is an array of [word_to_click, expected_line].1721 def verify_clicks(kind:, opts:, input:, clicks:)1722 var = kind.to_s.upcase # HEADER or FOOTER1723 binding = "click-#{kind}:transform-prompt:" \1724 "echo \"L=$FZF_CLICK_#{var}_LINE W=$FZF_CLICK_#{var}_WORD> \""1725 # --multi makes the info line end in " (0)" so the wait regex is unambiguous.1726 tmux.send_keys %(#{input} | #{FZF} #{opts} --multi --bind '#{binding}'), :Enter1727 # Wait for fzf to fully render before inspecting the screen, otherwise the echoed1728 # command line can shadow click targets.1729 tmux.until { |lines| lines.any_include?(%r{ [0-9]+/[0-9]+ \(0\)}) }1730 clicks.each do |word, line|1731 click_word(word)1732 tmux.until { |lines| assert lines.any_include?("L=#{line} W=#{word}>") }1733 end1734 tmux.send_keys 'Escape'1735 end17361737 # Header lines (--header-lines) are rendered in reverse display order only under1738 # layout=default; in layout=reverse and layout=reverse-list they keep the input order.1739 # FZF_CLICK_HEADER_LINE reflects the visual row, so the expected value flips.1740 HEADER_CLICKS = [%w[Aaa 1], %w[Bbb 2], %w[Ccc 3]].freeze17411742 %w[default reverse reverse-list].each do |layout|1743 slug = layout.tr('-', '_')17441745 # Plain --header with no border around the header section.1746 define_method(:"test_click_header_plain_#{slug}") do1747 verify_clicks(kind: :header,1748 opts: %(--layout=#{layout} --header $'Aaa\\nBbb\\nCcc'),1749 input: 'seq 5',1750 clicks: HEADER_CLICKS)1751 end17521753 # --header with a framing border (--style full gives --header-border=rounded by default).1754 define_method(:"test_click_header_border_rounded_#{slug}") do1755 verify_clicks(kind: :header,1756 opts: %(--layout=#{layout} --style full --header $'Aaa\\nBbb\\nCcc'),1757 input: 'seq 5',1758 clicks: HEADER_CLICKS)1759 end17601761 # --header-lines consumed from stdin, with its own framing border.1762 define_method(:"test_click_header_lines_border_rounded_#{slug}") do1763 clicks_hl = if layout == 'default'1764 [%w[Xaa 3], %w[Ybb 2], %w[Zcc 1]]1765 else1766 [%w[Xaa 1], %w[Ybb 2], %w[Zcc 3]]1767 end1768 verify_clicks(kind: :header,1769 opts: %(--layout=#{layout} --style full --header-lines 3),1770 input: "(printf 'Xaa\\nYbb\\nZcc\\n'; seq 5)",1771 clicks: clicks_hl)1772 end17731774 # --footer with a framing border.1775 define_method(:"test_click_footer_border_rounded_#{slug}") do1776 verify_clicks(kind: :footer,1777 opts: %(--layout=#{layout} --style full --footer $'Foo\\nBar\\nBaz'),1778 input: 'seq 5',1779 clicks: [%w[Foo 1], %w[Bar 2], %w[Baz 3]])1780 end

Add a test case for click-header with --header and --header-lines combinedJunegunn Choibefore adoptionef6eba1

lines 1781–1800why, one step back
1781
1782 # --header and --header-lines combined. Click-header numbering concatenates the two1783 # sections, but the order depends on the layout:1784 # layoutReverse: custom header (1..N), then header-lines (N+1..N+M)1785 # layoutDefault: header-lines (1..M, reversed visually), then custom header (M+1..M+N)1786 # layoutReverseList: header-lines (1..M), then custom header (M+1..M+N)1787 define_method(:"test_click_header_combined_#{slug}") do1788 clicks = case layout1789 when 'reverse'1790 [%w[Aaa 1], %w[Bbb 2], %w[Ccc 3], %w[Xaa 4], %w[Ybb 5], %w[Zcc 6]]1791 when 'default'1792 [%w[Aaa 4], %w[Bbb 5], %w[Ccc 6], %w[Xaa 3], %w[Ybb 2], %w[Zcc 1]]1793 else # reverse-list1794 [%w[Aaa 4], %w[Bbb 5], %w[Ccc 6], %w[Xaa 1], %w[Ybb 2], %w[Zcc 3]]1795 end1796 verify_clicks(kind: :header,1797 opts: %(--layout=#{layout} --header $'Aaa\\nBbb\\nCcc' --header-lines 3),1798 input: "(printf 'Xaa\\nYbb\\nZcc\\n'; seq 5)",1799 clicks: clicks)1800 end

Add --{header,header-lines,footer}-border=inlineJunegunn Choibefore adoptiond754cfa

lines 1801–1874why, one step back
1801
1802 # Inline header inside a rounded list border.1803 define_method(:"test_click_header_border_inline_#{slug}") do1804 opts = %(--layout=#{layout} --style full --header $'Aaa\\nBbb\\nCcc' --header-border=inline)1805 verify_clicks(kind: :header, opts: opts, input: 'seq 5', clicks: HEADER_CLICKS)1806 end18071808 # Inline header inside a horizontal list border (top+bottom only, no T-junctions).1809 define_method(:"test_click_header_border_inline_horizontal_list_#{slug}") do1810 opts = %(--layout=#{layout} --style full --list-border=horizontal --header $'Aaa\\nBbb\\nCcc' --header-border=inline)1811 verify_clicks(kind: :header, opts: opts, input: 'seq 5', clicks: HEADER_CLICKS)1812 end18131814 # Inline header-lines inside a rounded list border.1815 define_method(:"test_click_header_lines_border_inline_#{slug}") do1816 clicks_hl = if layout == 'default'1817 [%w[Xaa 3], %w[Ybb 2], %w[Zcc 1]]1818 else1819 [%w[Xaa 1], %w[Ybb 2], %w[Zcc 3]]1820 end1821 opts = %(--layout=#{layout} --style full --header-lines 3 --header-lines-border=inline)1822 verify_clicks(kind: :header, opts: opts,1823 input: "(printf 'Xaa\\nYbb\\nZcc\\n'; seq 5)",1824 clicks: clicks_hl)1825 end18261827 # Inline footer inside a rounded list border.1828 define_method(:"test_click_footer_border_inline_#{slug}") do1829 opts = %(--layout=#{layout} --style full --footer $'Foo\\nBar\\nBaz' --footer-border=inline)1830 verify_clicks(kind: :footer, opts: opts, input: 'seq 5',1831 clicks: [%w[Foo 1], %w[Bar 2], %w[Baz 3]])1832 end1833 end18341835 # An inline section requesting far more rows than the terminal can fit must not1836 # break the layout. The list frame must still render inside the pane with both1837 # corners visible and the prompt line present.1838 def test_inline_header_lines_oversized1839 tmux.send_keys %(seq 10000 | #{FZF} --style full --header-border inline --header-lines 9999), :Enter1840 tmux.until { |lines| lines.any_include?(%r{ [0-9]+/[0-9]+}) }1841 lines = tmux.capture1842 # Rounded (light) and sharp (tcell) default border glyphs.1843 top_corners = /[╭┌]/1844 bottom_corners = /[╰└]/1845 assert(lines.any? { |l| l.match?(top_corners) }, "list frame top missing: #{lines.inspect}")1846 assert(lines.any? { |l| l.match?(bottom_corners) }, "list frame bottom missing: #{lines.inspect}")1847 assert(lines.any? { |l| l.include?('>') }, "prompt missing: #{lines.inspect}")1848 tmux.send_keys 'Escape'1849 end18501851 # A non-inline section that consumes all available rows must still render without1852 # crashing when another section is inline but has no budget. The inline section's1853 # content is clipped to 0 but the layout proceeds.1854 def test_inline_footer_starved_by_non_inline_header1855 tmux.send_keys %(seq 10000 | #{FZF} --style full --footer-border inline --footer "$(seq 1000)" --header "$(seq 1000)"), :Enter1856 tmux.until { |lines| lines.any_include?(%r{ [0-9]+/[0-9]+}) }1857 lines = tmux.capture1858 assert(lines.any? { |l| l.include?('>') }, "prompt missing: #{lines.inspect}")1859 tmux.send_keys 'Escape'1860 end18611862 # Without a line-drawing --list-border, --header-border=inline must silently1863 # fall back to the `line` style (documented behavior).1864 def test_inline_falls_back_without_list_border1865 tmux.send_keys %(seq 5 | #{FZF} --list-border=none --header HEADER --header-border=inline), :Enter1866 tmux.until { |lines| lines.any_include?(%r{ [0-9]+/[0-9]+}) }1867 lines = tmux.capture1868 assert(lines.any? { |l| l.include?('HEADER') }, "header missing: #{lines.inspect}")1869 # Neither list frame corners (rounded/sharp) nor T-junction runes appear,1870 # since we've fallen back to a plain line separator.1871 assert(lines.none? { |l| l.match?(/[╭╮╰╯┌┐└┘├┤]/) }, "unexpected frame glyphs: #{lines.inspect}")1872 tmux.send_keys 'Escape'1873 end1874

Fix inline header/footer border color when falling back to lineJunegunn Choibefore adoption01567b4

lines 1875–1899why, one step back
1875 # Regression: when --header-border=inline falls back to `line` because the
1876 # list border can't host an inline separator, the header-border color must1877 # inherit from `border`, not `list-border`. The effective shape is `line`,1878 # so color inheritance must match what `line` rendering would use.1879 def test_inline_fallback_does_not_inherit_list_border_color1880 # Marker attribute (bold) on list-border. If HeaderBorder wrongly inherits1881 # from ListBorder, the header separator characters will carry the bold1882 # attribute. --info=hidden and --no-separator strip other separator lines1883 # so the only row of `─` chars is the header separator.1884 tmux.send_keys %(seq 5 | #{FZF} --list-border=none --header HEADER --header-border=inline --info=hidden --no-separator --color=bg:-1,list-border:red:bold), :Enter1885 sep_row = nil1886 tmux.until do |_|1887 sep_row = tmux.capture_ansi.find do |row|1888 stripped = row.gsub(/\e\[[\d;]*m/, '').rstrip1889 stripped.match?(/\A─+\z/)1890 end1891 !sep_row.nil?1892 end1893 # Bold (1) or red fg (31) on the header separator means it inherited from1894 # list-border even though the effective shape is `line` (non-inline).1895 refute_match(/\e\[(?:[\d;]*;)?(?:1|31)(?:;[\d;]*)?m─/, sep_row,1896 "header separator inherited list-border attr: #{sep_row.inspect}")1897 tmux.send_keys 'Escape'1898 end1899

Let inline sections take precedence over --header-firstJunegunn Choibefore adoptiondd7a081

lines 1900–1905why, one step back
1900 # Inline takes precedence over --header-first: the main header stays
1901 # inside the list frame instead of moving below the input.1902 def test_inline_header_border_overrides_header_first1903 tmux.send_keys %(seq 5 | #{FZF} --style full --header foo --header-first --header-border inline), :Enter1904 tmux.until do |lines|1905 foo_idx = lines.index { |l| l.match?(/\A│\s+foo\s+│\z/) }

Fix rubocop errorsJunegunn Choibefore adoptionaf42fde

line 1906why, one step back
1906 input_idx = lines.index { |l| l.match?(%r{\A│\s+>\s+\d+/\d+\s+│\z}) }

Let inline sections take precedence over --header-firstJunegunn Choibefore adoptiondd7a081

lines 1907–1918why, one step back
1907 foo_idx && input_idx && foo_idx < input_idx
1908 end1909 end19101911 # With both sections present, --header-first still moves the main --header1912 # below the input while --header-lines-border=inline keeps header-lines1913 # inside the list frame.1914 def test_inline_header_lines_with_header_first_and_main_header1915 tmux.send_keys %(seq 5 | #{FZF} --style full --header foo --header-lines 1 --header-first --header-lines-border inline), :Enter1916 tmux.until do |lines|1917 one_idx = lines.index { |l| l.match?(/\A│\s+1\s+│\z/) }1918 foo_idx = lines.index { |l| l.match?(/\A│\s+foo\s+│\z/) }

Fix rubocop errorsJunegunn Choibefore adoptionaf42fde

line 1919why, one step back
1919 input_idx = lines.index { |l| l.match?(%r{\A│\s+>\s+\d+/\d+\s+│\z}) }

Let inline sections take precedence over --header-firstJunegunn Choibefore adoptiondd7a081

lines 1920–1930why, one step back
1920 one_idx && foo_idx && input_idx && one_idx < input_idx && input_idx < foo_idx
1921 end1922 end19231924 # With no main --header, --header-first previously repositioned1925 # header-lines. Inline now takes precedence: header-lines stays inside1926 # the list frame.1927 def test_inline_header_lines_with_header_first_no_main_header1928 tmux.send_keys %(seq 5 | #{FZF} --style full --header-lines 1 --header-first --header-lines-border inline), :Enter1929 tmux.until do |lines|1930 one_idx = lines.index { |l| l.match?(/\A│\s+1\s+│\z/) }

Fix rubocop errorsJunegunn Choibefore adoptionaf42fde

line 1931why, one step back
1931 input_idx = lines.index { |l| l.match?(%r{\A│\s+>\s+\d+/\d+\s+│\z}) }

Let inline sections take precedence over --header-firstJunegunn Choibefore adoptiondd7a081

lines 1932–1935why, one step back
1932 one_idx && input_idx && one_idx < input_idx
1933 end1934 end1935

Redraw when change-header changes line countJunegunn Choibefore adoption1986d10

lines 1936–1942why, one step back
1936 # Regression: with --header-border=inline and --header-lines but no
1937 # --header, the inline slot was sized for header-lines only. After1938 # change-header added a main header line, resizeIfNeeded tolerated the1939 # too-small slot, so the header-lines line got displaced and disappeared.1940 def test_inline_change_header_grows_slot1941 tmux.send_keys %(seq 5 | #{FZF} --style full --header-lines 1 --header-border inline --bind space:change-header:tada), :Enter1942 tmux.until { |lines| lines.any_include?(/\A│\s+1\s+│\z/) }

Redraw when change-footer changes line countJunegunn Choibefore adoption56be412

line 1943why, one step back
1943 tmux.send_keys :Space

Redraw when change-header changes line countJunegunn Choibefore adoption1986d10

lines 1944–1945why, one step back
1944 tmux.until do |lines|
1945 lines.any_include?(/\A│\s+1\s+│\z/) && lines.any_include?(/\A│\s+tada\s+│\z/)

Redraw when change-footer changes line countJunegunn Choibefore adoption56be412

lines 1946–1957why, one step back
1946 end
1947 end19481949 # Regression: with --footer-border=inline, change-footer that grows the1950 # footer line count left the inline slot sized for the old length, so1951 # extra lines were clipped.1952 def test_inline_change_footer_grows_slot1953 tmux.send_keys %(seq 5 | #{FZF} --style full --footer-border inline --footer one --bind $'space:change-footer:one\\ntwo'), :Enter1954 tmux.until { |lines| lines.any_include?(/\A│\s+one\s+│\z/) }1955 tmux.send_keys :Space1956 tmux.until do |lines|1957 lines.any_include?(/\A│\s+one\s+│\z/) && lines.any_include?(/\A│\s+two\s+│\z/)

Redraw when change-header changes line countJunegunn Choibefore adoption1986d10

lines 1958–1960why, one step back
1958 end
1959 end1960

Add --{header,header-lines,footer}-border=inlineJunegunn Choibefore adoptiond754cfa

lines 1961–2038why, one step back
1961 # Invalid inline combinations must be rejected at startup.
1962 def test_inline_rejected_on_unsupported_options1963 [1964 ['--border=inline', 'inline border is only supported'],1965 ['--list-border=inline', 'inline border is only supported'],1966 ['--input-border=inline', 'inline border is only supported'],1967 ['--preview-window=border-inline --preview :', 'invalid preview window option: border-inline'],1968 ['--header-border=inline --header-lines-border=sharp --header-lines=1',1969 '--header-border=inline requires --header-lines-border to be inline or unset']1970 ].each do |args, expected|1971 output = `#{FZF} #{args} < /dev/null 2>&1`1972 refute_equal 0, $CHILD_STATUS.exitstatus, "expected non-zero exit for: #{args}"1973 assert_includes output, expected, "wrong error for: #{args}"1974 end1975 end19761977 private19781979 # Count rows whose entire width is a single `color` range.1980 def count_full_rows(ranges_by_row, color)1981 ranges_by_row.count { |r| r.length == 1 && r[0][2] == color }1982 end19831984 # Wait until `tmux.bg_ranges` has at least `count` fully-`color` rows; return them.1985 def wait_for_full_rows(color, count)1986 ranges = nil1987 tmux.until do |_|1988 ranges = tmux.bg_ranges1989 count_full_rows(ranges, color) >= count1990 end1991 ranges1992 end19931994 public19951996 # Inline header's entire section (outer edge + content-row verticals + separator)1997 # carries the header-bg color; list rows below carry list-bg.1998 def test_inline_header_bg_color1999 tmux.send_keys %(seq 5 | #{FZF} --list-border --reverse --header HEADER --header-border=inline --color=bg:-1,header-border:white,list-border:white,header-bg:red,list-bg:green), :Enter2000 tmux.until { |lines| lines.any_include?(%r{ [0-9]+/[0-9]+}) }

The first 2,000 of 2,040 lines.