mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-07 07:30:20 +09:00
The option is `scrollbar` and is off by default. The scroll bar is not interactive (you can't click and drag it) but this will likely be fixed in the future. Ref #869
19 lines
395 B
Go
19 lines
395 B
Go
package main
|
|
|
|
type ScrollBar struct {
|
|
view *View
|
|
}
|
|
|
|
func (sb *ScrollBar) Display() {
|
|
style := defStyle.Reverse(true)
|
|
screen.SetContent(sb.view.x+sb.view.Width-1, sb.view.y+sb.Pos(), ' ', nil, style)
|
|
}
|
|
|
|
func (sb *ScrollBar) Pos() int {
|
|
numlines := sb.view.Buf.NumLines
|
|
h := sb.view.Height
|
|
filepercent := float32(sb.view.Topline) / float32(numlines)
|
|
|
|
return int(filepercent * float32(h))
|
|
}
|