mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 11:29:01 +00:00
Fix scrollbar rendering (#3096)
This commit is contained in:
parent
088293f5e7
commit
aa71a07fbe
@ -1421,11 +1421,21 @@ func (t *Terminal) printItem(result Result, line int, i int, current bool, bar b
|
|||||||
newLine := itemLine{current: current, selected: selected, label: label,
|
newLine := itemLine{current: current, selected: selected, label: label,
|
||||||
result: result, queryLen: len(t.input), width: 0, bar: bar}
|
result: result, queryLen: len(t.input), width: 0, bar: bar}
|
||||||
prevLine := t.prevLines[i]
|
prevLine := t.prevLines[i]
|
||||||
|
printBar := func() {
|
||||||
|
if len(t.scrollbar) > 0 && bar != prevLine.bar {
|
||||||
|
t.move(line, t.window.Width()-1, true)
|
||||||
|
if bar {
|
||||||
|
t.window.CPrint(tui.ColScrollbar, t.scrollbar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if prevLine.current == newLine.current &&
|
if prevLine.current == newLine.current &&
|
||||||
prevLine.selected == newLine.selected &&
|
prevLine.selected == newLine.selected &&
|
||||||
prevLine.label == newLine.label &&
|
prevLine.label == newLine.label &&
|
||||||
prevLine.queryLen == newLine.queryLen &&
|
prevLine.queryLen == newLine.queryLen &&
|
||||||
prevLine.result == newLine.result {
|
prevLine.result == newLine.result {
|
||||||
|
printBar()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1459,12 +1469,7 @@ func (t *Terminal) printItem(result Result, line int, i int, current bool, bar b
|
|||||||
if fillSpaces > 0 {
|
if fillSpaces > 0 {
|
||||||
t.window.Print(strings.Repeat(" ", fillSpaces))
|
t.window.Print(strings.Repeat(" ", fillSpaces))
|
||||||
}
|
}
|
||||||
if len(t.scrollbar) > 0 && bar != prevLine.bar {
|
printBar()
|
||||||
t.move(line, t.window.Width()-1, true)
|
|
||||||
if bar {
|
|
||||||
t.window.CPrint(tui.ColScrollbar, t.scrollbar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t.prevLines[i] = newLine
|
t.prevLines[i] = newLine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user