mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
Use slimmer scrollbars
The previous scrollbars were too chunky and encroached too much on a view's content. The new ones are slim and right-aligned so they encroach into dead space between views which is much better
This commit is contained in:
19
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
19
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@ -860,7 +860,7 @@ func (g *Gui) drawFrameEdges(v *View, fgColor, bgColor Attribute) error {
|
||||
}
|
||||
}
|
||||
if v.x1 > -1 && v.x1 < g.maxX {
|
||||
runeToPrint := calcScrollbarRune(showScrollbar, realScrollbarStart, realScrollbarEnd, v.y0+1, v.y1-1, y, runeV)
|
||||
runeToPrint := calcScrollbarRune(showScrollbar, realScrollbarStart, realScrollbarEnd, y, runeV)
|
||||
|
||||
if err := g.SetRune(v.x1, y, runeToPrint, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
@ -870,18 +870,11 @@ func (g *Gui) drawFrameEdges(v *View, fgColor, bgColor Attribute) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func calcScrollbarRune(showScrollbar bool, scrollbarStart int, scrollbarEnd int, rangeStart int, rangeEnd int, position int, runeV rune) rune {
|
||||
if !showScrollbar {
|
||||
return runeV
|
||||
} else if position == rangeStart {
|
||||
return '▲'
|
||||
} else if position == rangeEnd {
|
||||
return '▼'
|
||||
} else if position > scrollbarStart && position < scrollbarEnd {
|
||||
return '█'
|
||||
} else if position > rangeStart && position < rangeEnd {
|
||||
// keeping this as a separate branch in case we later want to render something different here.
|
||||
return runeV
|
||||
func calcScrollbarRune(
|
||||
showScrollbar bool, scrollbarStart int, scrollbarEnd int, position int, runeV rune,
|
||||
) rune {
|
||||
if showScrollbar && (position >= scrollbarStart && position <= scrollbarEnd) {
|
||||
return '▐'
|
||||
} else {
|
||||
return runeV
|
||||
}
|
||||
|
Reference in New Issue
Block a user