summaryrefslogtreecommitdiffstats
path: root/src/terminal.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-05-14 18:28:46 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-05-16 23:24:05 +0900
commit5a391024059e055f9e21b997ff77e1b4ba5302c5 (patch)
tree0e9195c80598cc1b34e45c13882f79495859a352 /src/terminal.go
parent94999101e358385f3ca67a6ec9512f549196b802 (diff)
Allow customizing the color of preview scrollbar via 'preview-scrollbar'
Diffstat (limited to 'src/terminal.go')
-rw-r--r--src/terminal.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/terminal.go b/src/terminal.go
index d108bfd9..fadfd6c4 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -1930,7 +1930,9 @@ func (t *Terminal) renderPreviewText(height int, lines []string, lineNo int, unc
func (t *Terminal) renderPreviewScrollbar(yoff int, barLength int, barStart int) {
height := t.pwindow.Height()
w := t.pborder.Width()
+ redraw := false
if len(t.previewer.bar) != height {
+ redraw = true
t.previewer.bar = make([]bool, height)
}
xshift := -1 - t.borderWidth
@@ -1947,7 +1949,7 @@ func (t *Terminal) renderPreviewScrollbar(yoff int, barLength int, barStart int)
// Avoid unnecessary redraws
bar := i >= yoff+barStart && i < yoff+barStart+barLength
- if bar == t.previewer.bar[i] && !t.tui.NeedScrollbarRedraw() {
+ if !redraw && bar == t.previewer.bar[i] && !t.tui.NeedScrollbarRedraw() {
continue
}
@@ -1956,7 +1958,7 @@ func (t *Terminal) renderPreviewScrollbar(yoff int, barLength int, barStart int)
if i >= yoff+barStart && i < yoff+barStart+barLength {
t.pborder.CPrint(tui.ColPreviewScrollbar, t.scrollbar)
} else {
- t.pborder.Print(" ")
+ t.pborder.CPrint(tui.ColPreviewScrollbar, " ")
}
}
}