text - ncurses 滚动窗口的文本内容

标签 text scroll terminal window ncurses

我正在寻找有关使用 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/

相关文章:

c# - 将文本转换为 unicode 字符串

iphone - 防止重新加载缓存的 iPhone Web 应用程序(滚动到顶部)

android - 通过单击按钮滚动到 nestedscrollview 中的 Textview

html - 如何让页面滚动到较长文本中的特定单词

c++ - 如何同步终端上的输入和输出?

python - 使用 Python 解析文本文件

c++ - 从 C++ 输出流到 Android TextView 或等效的适配器?

visual-studio-code - 当 Zshell 主题存在时,终端开始表现不佳

c - 在 C 中读取具有不同扩展名的 .txt 文件

python - 在 python 中执行时 autossh 不工作