NCURSES不会在elementryOS终端

时间:2017-01-10 07:16:26

标签: c linux scrollbar ncurses

我一直在使用NCURSES库来完成我的任务,但它有一个很大的问题。 我不能让它在终端窗口上显示滚动条。我尝试过任何我发现here的东西,但似乎都没有。 我在StackExhcange中找到了这个代码部分,但即使这样也没有显示schrollbars。

#include <ncurses.h>

int main(void)
{
int i = 0;

initscr();

scrollok(stdscr,TRUE);

while(i<500) {
    printw("%3d - lots and lots of lines flowing down the terminal\n", i);
    ++i;
    refresh();
}

getchar();

endwin();
return 0;
}

它是否与elementaryOS有关,因为我听说它已被修改。

1 个答案:

答案 0 :(得分:2)

两种可能性:

  • 终端说明可能正在使用xterm alternate screen feature。由于滚动被禁用,因此某些终端在使用备用屏幕时不会显示滚动条。例如,默认情况下,您正在使用的真实终端的VTE在此模式下具有(硬编码)行为,可将您的滚动转换为上/下光标键。
  • OP期望curses应用程序显示滚动条。除非应用程序模拟滚动条,否则它们不会。

例如,dialog执行后者。这是一个例子:

screenshot of dialog with simulated scrollbars