Fix weird scrolling behaviour when clearing terminal buffer.