mouse demo redraw screen on window resize

This commit is contained in:
Kovid Goyal 2024-07-20 17:05:30 +05:30
parent 9c9041cf57
commit ff2baf9122
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -67,6 +67,7 @@ func Run(args []string) (rc int, err error) {
lp.AllowLineWrapping(false)
defer lp.AllowLineWrapping(true)
if current_mouse_event == nil {
lp.ClearScreen()
lp.Println(`Move the mouse or click to see mouse events`)
return
}
@ -150,6 +151,10 @@ func Run(args []string) (rc int, err error) {
}
return nil
}
lp.OnResize = func(old_size loop.ScreenSize, new_size loop.ScreenSize) error {
draw_screen()
return nil
}
err = lp.Run()
if err != nil {
rc = 1