Compare commits
2 commits
8d38a07348
...
da53b8c6b6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
da53b8c6b6 | ||
![]() |
56fa219d2d |
3
Main.go
3
Main.go
|
@ -22,9 +22,6 @@ func main() {
|
|||
if err := drw.Wall.Init(); err != nil {
|
||||
log.Fatalf("%+v", err)
|
||||
}
|
||||
drw.DefStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
||||
drw.TodayStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.GetColor("blue")).Bold(true).Reverse(true)
|
||||
drw.SelStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.GetColor("green")).Bold(true)
|
||||
|
||||
drw.Wall.SetStyle(drw.DefStyle)
|
||||
drw.Wall.Clear()
|
||||
|
|
15
drw/drw.go
15
drw/drw.go
|
@ -15,9 +15,18 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
DefStyle tcell.Style
|
||||
TodayStyle tcell.Style
|
||||
SelStyle tcell.Style
|
||||
DefStyle tcell.Style = tcell.StyleDefault.
|
||||
Background(tcell.ColorReset).
|
||||
Foreground(tcell.ColorReset)
|
||||
TodayStyle tcell.Style = tcell.StyleDefault.
|
||||
Background(tcell.ColorReset).
|
||||
Foreground(tcell.GetColor("blue")).
|
||||
Bold(true).
|
||||
Reverse(true)
|
||||
SelStyle tcell.Style = tcell.StyleDefault.
|
||||
Background(tcell.ColorReset).
|
||||
Foreground(tcell.GetColor("green")).
|
||||
Bold(true)
|
||||
)
|
||||
|
||||
func centeredText(s string, x, y, width int, scr tcell.Screen, style tcell.Style) {
|
||||
|
|
|
@ -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