]> git.lizzy.rs Git - micro.git/blob - cmd/micro/scrollbar.go
Merge pull request #891 from pranavraja/master
[micro.git] / cmd / micro / scrollbar.go
1 package main
2
3 type ScrollBar struct {
4         view *View
5 }
6
7 func (sb *ScrollBar) Display() {
8         style := defStyle.Reverse(true)
9         screen.SetContent(sb.view.x+sb.view.Width-1, sb.view.y+sb.Pos(), ' ', nil, style)
10 }
11
12 func (sb *ScrollBar) Pos() int {
13         numlines := sb.view.Buf.NumLines
14         h := sb.view.Height
15         filepercent := float32(sb.view.Topline) / float32(numlines)
16
17         return int(filepercent * float32(h))
18 }