Enable screen resizing

This commit is contained in:
Petar Kapriš 2021-08-28 09:39:28 +02:00 committed by Петар Каприш
parent b7f2276d18
commit 66695e069b

View file

@ -117,6 +117,7 @@ func drawMonth(m time.Month, x, y int) {
}
func drawWall() {
wall.Clear()
w, h := wall.Size()
if w < monthWidth + 2 * smallGap || h < monthHeight + 2 * smallGap + titleHeight {
wrappedText("Екран је премали за календар.", wall, defStyle)
@ -174,6 +175,7 @@ func main() {
// Process event
switch ev := ev.(type) {
case *tcell.EventResize:
drawWall()
wall.Sync()
case *tcell.EventKey:
if ev.Key() == tcell.KeyEscape || ev.Key() == tcell.KeyCtrlC ||