3 // ScrollBar represents an optional scrollbar that can be used
4 type ScrollBar struct {
8 // Display shows the scrollbar
9 func (sb *ScrollBar) Display() {
10 style := defStyle.Reverse(true)
11 screen.SetContent(sb.view.x+sb.view.Width-1, sb.view.y+sb.pos(), ' ', nil, style)
14 func (sb *ScrollBar) pos() int {
15 numlines := sb.view.Buf.NumLines
17 filepercent := float32(sb.view.Topline) / float32(numlines)
19 return int(filepercent * float32(h))