Fixed the bug where resizing the screen while the msg buffer is longer than the screen width causes problems.