Calendar only scrolls automatically if viewing the current month
This commit is contained in:
parent
a71fb3de4b
commit
b819da0419
8
main.go
8
main.go
@ -123,16 +123,22 @@ func tick () {
|
||||
time.Sleep(time.Second)
|
||||
drawMutex.Lock()
|
||||
|
||||
pageSize := columns * rows
|
||||
within :=
|
||||
currentMonth >= viewingMonth &&
|
||||
currentMonth < viewingMonth + pageSize
|
||||
|
||||
newMonth := canonMonth(time.Now())
|
||||
if currentMonth != newMonth {
|
||||
currentMonth = newMonth
|
||||
|
||||
pageSize := columns * rows
|
||||
if within {
|
||||
if currentMonth < viewingMonth {
|
||||
viewingMonth -= pageSize
|
||||
} else if currentMonth >= viewingMonth + pageSize {
|
||||
viewingMonth += pageSize
|
||||
}
|
||||
}
|
||||
|
||||
application.Clear()
|
||||
redraw()
|
||||
|
Loading…
Reference in New Issue
Block a user