Compare commits

..

No commits in common. "da53b8c6b6888e46f2ae03dbc19b0851b449503d" and "8d38a07348c8e937ac7aeba2d60b16557b4f5b4d" have entirely different histories.

3 changed files with 10 additions and 16 deletions

View file

@ -22,6 +22,9 @@ 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()

View file

@ -15,18 +15,9 @@ var (
)
var (
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)
DefStyle tcell.Style
TodayStyle tcell.Style
SelStyle tcell.Style
)
func centeredText(s string, x, y, width int, scr tcell.Screen, style tcell.Style) {

View file

@ -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()
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 >= 1 {
} else if int(util.SelTime.Month()) > monthsWide {
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())+monthsWide <= 12 {
} else if int(util.SelTime.Month()) <= (12-1)/monthsWide*monthsWide {
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 && util.SelTime.Month() != time.December {
} else if int(util.SelTime.Month())%monthsWide != 0 && int(util.SelTime.Month()) != 12 {
util.SelTime = leftmostInRow(util.SelTime.Month()+1, rowInMonth(util.SelTime.Month(), util.SelTime.Day()))
}
}