Skip to content
Myr

toggle-preview should not show empty preview window

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent fccab60 · Browse files · 2 files+39 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+39 added−1 removed

  • tests:+38 added−0 removed
  • other:+1 added−1 removed

2 files+39 added−1 removed

modified:src/terminal.go+1 added-1 removed
2865 unmodified lines
2866 case actInvalid:2867 t.mutex.Unlock()2868 return false2869 case actTogglePreview:2870 if t.hasPreviewer() {2870 if t.hasPreviewWindow() || len(t.previewOpts.command) > 0 {2871 t.activePreviewOpts.Toggle()2872 updatePreviewWindow(false)2873 if t.isPreviewEnabled() {2874 valid, list := t.buildPlusList(t.previewOpts.command, false, false)
692 unmodified lines
modified:test/test_go.rb+38 added
1455 unmodified lines
1456 tmux.send_keys :BTab1457 tmux.until { |lines| assert_includes lines[1], ' {5-1 3 4} ' }1458 end14591460 def test_toggle_preview_without_default_preview_command1461 tmux.send_keys %(seq 100 | #{FZF} --bind 'space:preview(echo [{}]),enter:toggle-preview' --preview-window up,border-double), :Enter1462 tmux.until do |lines|1463 assert_equal 100, lines.match_count1464 refute_includes lines[1], '║ [1]'1465 end14661467 # toggle-preview should do nothing1468 tmux.send_keys :Enter1469 tmux.until { |lines| refute_includes lines[1], '║ [1]' }1470 tmux.send_keys :Up1471 tmux.until do |lines|1472 refute_includes lines[1], '║ [1]'1473 refute_includes lines[1], '║ [2]'1474 end14751476 tmux.send_keys :Up1477 tmux.until do |lines|1478 assert_includes lines, '> 3'1479 refute_includes lines[1], '║ [3]'1480 end14811482 # One-off preview action1483 tmux.send_keys :Space1484 tmux.until { |lines| assert_includes lines[1], '║ [3]' }14851486 # toggle-preview to hide it1487 tmux.send_keys :Enter1488 tmux.until { |lines| refute_includes lines[1], '║ [3]' }14891490 # toggle-preview again does nothing1491 tmux.send_keys :Enter, :Up1492 tmux.until do |lines|1493 assert_includes lines, '> 4'1494 refute_includes lines[1], '║ [4]'1495 end1496 end14971498 def test_preview_hidden1499 tmux.send_keys %(seq 1000 | #{FZF} --preview 'echo {{}-{}-$FZF_PREVIEW_LINES-$FZF_PREVIEW_COLUMNS}' --preview-window down:1:hidden --bind ?:toggle-preview), :Enter1500 tmux.until { |lines| assert_equal '>', lines[-1] }1501 tmux.send_keys '?'
1590 unmodified lines