我正在寻找有关使用 ncurses 在窗口或 pad 中滚动方法的明确答案。
我想显示一个标准输出流,它可以快速填满屏幕上的可用行数并开始溢出。使用 stdio 终端简单地滚动内容。但据我所知,ncurses 的输出仅限于屏幕区域。这完全准确吗?
通常的方法是将 stdout 的全部内容放入缓冲区,然后将缓冲区的特定部分读取到 ncurses 窗口或 pad 中吗?还有哪些其他方法可以使用 ncurses 滚动文本?
最佳答案
你可能忽略了scrollok
:
The scrollok option controls what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last line. If disabled, (bf is FALSE), the cursor is left on the bottom line. If enabled, (bf is TRUE), the window is scrolled up one line (Note that to get the physical scrolling effect on the terminal, it is also necessary to call idlok).
使用它,您可以写入任何窗口,并让它向上滚动——就像 stdio 一样。
进一步阅读:
关于text - ncurses 滚动窗口的文本内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34656019/