Edit wall-movement functions in drw for clarity
This commit is contained in:
parent
8d38a07348
commit
56fa219d2d
|
@ -44,8 +44,8 @@ func monthHeight(m time.Month) int {
|
|||
|
||||
func bottomOfMonth(m time.Month, w time.Weekday) (time time.Time) {
|
||||
last := lastDay(m)
|
||||
day := last.Day()
|
||||
|
||||
day := last.Day()
|
||||
if w > last.Weekday() {
|
||||
day -= 7
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ func MoveUp() {
|
|||
newTime := util.SelTime.AddDate(0, 0, -7)
|
||||
if newTime.Month() == util.SelTime.Month() {
|
||||
util.SelTime = newTime
|
||||
} else if int(util.SelTime.Month()) > monthsWide {
|
||||
} else if int(util.SelTime.Month())-monthsWide >= 1 {
|
||||
newMonth := util.SelTime.Month() - time.Month(monthsWide)
|
||||
util.SelTime = bottomOfMonth(newMonth, weekday)
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ func MoveDown() {
|
|||
newTime := util.SelTime.AddDate(0, 0, +7)
|
||||
if newTime.Month() == util.SelTime.Month() {
|
||||
util.SelTime = newTime
|
||||
} else if int(util.SelTime.Month()) <= (12-1)/monthsWide*monthsWide {
|
||||
} else if int(util.SelTime.Month())+monthsWide <= 12 {
|
||||
newMonth := util.SelTime.Month() + time.Month(monthsWide)
|
||||
util.SelTime = topOfMonth(newMonth, weekday)
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ func MoveDown() {
|
|||
func MoveRight() {
|
||||
if util.SelTime.Weekday() != time.Sunday && util.SelTime.Day() != lastDay(util.SelTime.Month()).Day() {
|
||||
util.SelTime = util.SelTime.AddDate(0, 0, 1)
|
||||
} else if int(util.SelTime.Month())%monthsWide != 0 && int(util.SelTime.Month()) != 12 {
|
||||
} else if int(util.SelTime.Month())%monthsWide != 0 && util.SelTime.Month() != time.December {
|
||||
util.SelTime = leftmostInRow(util.SelTime.Month()+1, rowInMonth(util.SelTime.Month(), util.SelTime.Day()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue