Skip to content

Commit febaadb

Browse files
committed
Fix stray character artifacts when scrollbar is hidden
Fix #4537
1 parent 0e67c5a commit febaadb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/terminal.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,6 +2397,13 @@ func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
23972397
innerHeight-shrink, tui.WindowList, noBorder, true)
23982398
}
23992399

2400+
if len(t.scrollbar) == 0 {
2401+
for y := 0; y < t.window.Height(); y++ {
2402+
t.window.Move(y, t.window.Width()-1)
2403+
t.window.Print(" ")
2404+
}
2405+
}
2406+
24002407
createInnerWindow := func(b tui.Window, shape tui.BorderShape, windowType tui.WindowType, shift int) tui.Window {
24012408
top := b.Top()
24022409
left := b.Left() + shift

test/test_layout.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,29 @@ def test_gutter_custom
11921192
tmux.until { assert_block(block, it) }
11931193
end
11941194

1195+
# https://github.com/junegunn/fzf/issues/4537
1196+
def test_no_scrollbar_preview_toggle
1197+
x = 'x' * 300
1198+
y = 'y' * 300
1199+
tmux.send_keys %(yes #{x} | head -1000 | fzf --bind 'tab:toggle-preview' --border --no-scrollbar --preview 'echo #{y}' --preview-window 'border-left'), :Enter
1200+
1201+
# │ ▌ xxxxxxxx·· │ yyyyyyyy│
1202+
tmux.until do |lines|
1203+
lines.any? { it.match?(/x·· │ y+│$/) }
1204+
end
1205+
tmux.send_keys :Tab
1206+
1207+
# │ ▌ xxxxxxxx·· │
1208+
tmux.until do |lines|
1209+
lines.none? { it.match?(/x··y│$/) }
1210+
end
1211+
1212+
tmux.send_keys :Tab
1213+
tmux.until do |lines|
1214+
lines.any? { it.match?(/x·· │ y+│$/) }
1215+
end
1216+
end
1217+
11951218
def test_combinations
11961219
skip unless ENV['LONGTEST']
11971220

0 commit comments

Comments
 (0)