如何在 ncurses 中模仿 TTY 行为?当我们到达底部时,向上推动屏幕上的所有线条
How to imitate TTY behavior in ncurses? Pushing all lines on screen upwards when we reach the bottom?
我希望将连续的输出打印到ncurses窗口中。当到达窗口底部时,我希望将所有行向上推 1 行(可能擦除或隐藏第一行)。在底部显示最新的线条。这是我通常期望从任何终端获得的行为。我需要 ncurses 的原因是我需要同时打印和获取输入,而对于普通终端,这没有很好地定义。
我当前的解决方案是将所有行保存在队列中,然后简单地重新打印队列中的前 n 行。是这样完成的,还是有没有办法在 API 中做同样的事情?
scroll(). 您必须先设置 scrollok(win, TRUE)。 实际上,如果您只想像普通终端一样喷出数据,则只需自行设置 scrollok()。
#include <ncurses.h>
int main(void)
{
initscr();
scrollok(stdscr,TRUE);
for (int i = 0; i < 100; ++i)
{
printw("%d - lots and lots of lines flowing down the terminaln", i);
refresh();
}
getch();
endwin();
return 0;
}
相关文章:
- 使用 SFML 和 C++ 将 Pixel 打印到屏幕上
- 要在屏幕上绘制一些小瓷砖,我应该使用 QQuickItem 还是 QQuickPaintedItem?
- 当我将元素推到矢量上时出错
- SFML 中的字体.信息不显示在屏幕上.显示的不是信息,而是点
- 如何在屏幕上环绕x和y?
- OpenGL ES 2.0将纹理绘制到屏幕上是行不通的
- 使用 fstream 库并在屏幕上打印的文件有问题?
- SFML 在屏幕上移动矩形时滞后/小卡顿
- 如何在Qt Android应用程序上禁用屏幕保护程序
- 使用C 构建器在窗户上拍摄屏幕截图的线程安全
- 用SDL2在每个帧上渲染屏幕的部分
- C 在Active Monitor上获得屏幕分辨率
- 使用DirectX在Windows上捕获屏幕
- 用c++在mac上录制屏幕
- 删除一个对象数组,该数组被上推为基指针
- OSX以最小的延迟将像素推到屏幕上
- 在 mac OS X 上清除屏幕
- 无法在 Linux 上使用屏幕外的 OpenGL 上下文生成 mipmap
- 在Windows 7上监视屏幕保护程序活动失败
- 在远程Windows服务器(Windows Vista或更高版本)上捕获屏幕