improve terminal resizing