handle scrolling like in the terminal