Another attempt to handle terminal resizing.