Calendar only scrolls automatically if viewing the current month

This commit is contained in:
Sasha Koshka 2022-11-28 17:21:28 -05:00
parent a71fb3de4b
commit b819da0419

View File

@ -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()