Skip to content
Myr

Fix preview scrollbar not rendered after toggle-preview

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

Fix #4732

authored by Junegunn Choi · committed by Junegunn Choi · parent 58b2855 · Browse files · 2 files+17 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+17 added−1 removed

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

2 files+17 added−1 removed

modified:src/terminal.go+1 added-1 removed
4628 unmodified lines
4629 height := t.pwindow.Height()4630 w := t.pborder.Width()4631 xw := [2]int{t.pwindow.Left(), t.pwindow.Width()}4632 redraw := false4633 if len(t.previewer.bar) != height || t.previewer.xw != xw {4633 if len(t.previewer.bar) != height || t.previewer.xw != xw || t.previewed.version != t.previewer.version {4634 redraw = true4635 t.previewer.bar = make([]bool, height)4636 t.previewer.xw = xw4637 }
3305 unmodified lines
modified:test/test_preview.rb+16 added
621 unmodified lines
622 assert_equal(2, lines.count { |line| line.include?('│ 1 │') })623 assert_equal(0, lines.count { |line| line.include?('│ h') })624 end625 end626627 def test_preview_toggle_should_redraw_scrollbar628 tmux.send_keys %(seq 1 | #{FZF} --no-border --scrollbar --preview 'seq $((FZF_PREVIEW_LINES + 1))' --preview-border line --bind tab:toggle-preview --header foo --header-border --footer bar --footer-border), :Enter629 tmux.until do |lines|630 assert_equal 1, lines.match_count631 assert_operator lines.count { |line| line.end_with?('│') }, :>, 2632 end633 tmux.send_keys :Tab634 tmux.until do |lines|635 assert_equal(2, lines.count { |line| line.end_with?('│') })636 end637 tmux.send_keys :Tab638 tmux.until do |lines|639 assert_operator lines.count { |line| line.end_with?('│') }, :>, 2640 end641 end642end