correctly resize the window on terminal size change