I am trying to implement an ncurses app with text scrolling like less. What is the recommended way to do this?
Here's what I know:
- You can use
scrollto move the text buffer up or down by 1 row. However, you'll end up with one blank line at the top if you scroll down, or at the bottom if you scroll up, which you'll have to repaint yourself. - Ncurses does wordwrap for you, which messes up my math when I have to determine what line I have to repaint in step 1.
I guess I could re-implement wordwrap myself and keep an array of all the post-wrapped lines, but this seems like a common problem, so there might be a better way.