Skip to content
Myr

Fix {show,hide,toggle}-input and add test cases

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 18cbb4a · Browse files · 2 files+20 added−2 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+20 added−2 removed

  • tests:+18 added−1 removed
  • other:+2 added−1 removed

2 files+20 added−2 removed

modified:src/terminal.go+2 added-1 removed
2531 unmodified lines
2532}25332534func (t *Terminal) resizeIfNeeded() bool {2535 // Check if input border is used and input has changed2536 if t.inputBorderShape.Visible() && t.inputWindow == nil && !t.inputless {2536 if t.inputBorderShape.Visible() && t.inputWindow == nil && !t.inputless || t.inputWindow != nil && t.inputless {2537 t.printAll()2538 return true2539 }2540
3406 unmodified lines
5947 if t.inputless {5948 // Always just discard the change5949 t.input = previousInput5950 t.cx = len(t.input)5951 beof = false5952 } else {5953 t.truncateQuery()5954 }5955 queryChanged = string(previousInput) != string(t.input)
269 unmodified lines
modified:test/test_layout.rb+18 added-1 removed
891 unmodified lines
892 tmux.until { assert_block(block, it) }893 end894895 def test_min_height_auto_no_input_reverse_list896 tmux.send_keys %(seq 100 | #{FZF} --style full:sharp --layout reverse-list --no-input --height 1% --min-height 5+), :Enter896 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), :Enter897898 block = <<~BLOCK899 ┌─────────900 │ > 1
3 unmodified lines
904 │ 5905 └─────────906 BLOCK907 tmux.until { assert_block(block, it) }908 tmux.send_keys :a909 block2 = <<~BLOCK910 ┌─────911 │ > 1912 │ 2913 └─────914 ┌─────915 │ >916 └─────917 BLOCK918 tmux.until { assert_block(block2, it) }919 tmux.send_keys :b920 tmux.until { assert_block(block, it) }921 tmux.send_keys :c922 tmux.until { assert_block(block2, it) }923 tmux.send_keys :c924 tmux.until { assert_block(block, it) }925 end926927 def test_layout_reverse_list928 prefix = "seq 5 | #{FZF} --layout reverse-list --no-list-border --height ~100% --border sharp "
53 unmodified lines