Question

I'm writing an app using ncurses which displays the status of tests running on multiple machines. It displays several progress bars at the bottom of the screen, and a failure log above them. However, the log may easily be longer than the rest of the terminal.

I'd like to have excess log roll off the top in such a way that if the user scrolls their terminal up they'll see the rest of the log. This is what happens when you scroll through a file using less; it replaces the current view with the next page, but the text you've passed ends up in the terminal's scrollback.

How can I get ncurses to do that?

Was it helpful?

Solution

Turns out this is easy. I just put a window at the top of the screen, made it scrollable (scrollok), and addstr'd text to it until it scrolled. The text scrolled right off into the scrollback without trouble.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top