def_prog_mode和reset_prog_mode刷新后curses键盘不起作用

发布于 2024-09-11 03:46:57 字数 672 浏览 4 评论 0原文

我正在尝试通过系统调用从 ncurses UI 转到编辑器,然后再返回。在此处几位友好程序员的帮助下,我学习了如何使用 def_prog_moderefresh 在用户从编辑器返回后恢复终端 UI 的状态。

所以我的代码看起来像这样:

// save state and exit ui
def_prog_mode();
endwin();

// system call...
system(...)

// restore ui
reset_prog_mode();
refresh();

这很好地恢复了我的 UI,但通常情况下,此后我的程序不再接受或响应键盘输入。我不确定在什么条件下会发生这种情况,但大多数情况下都会发生。

这似乎与此处的问题类似,但是所描述的修复(再次调用键盘)似乎不起作用。

I am trying to go from my ncurses UI to an editor via a system call and then back again. With the help of several friendly programmers here, I learned how to use def_prog_mode and refresh to restore the state of my terminal UI after the user returns from the editor.

So my code looks something like this:

// save state and exit ui
def_prog_mode();
endwin();

// system call...
system(...)

// restore ui
reset_prog_mode();
refresh();

This restores my UI quite nicely, but it is quite often the case that afterward my program no longer accepts or responds to keyboard input. I'm not sure under what conditions this happens, but it happens most of the time.

This seems similar to the problem here, but the fix described (calling keypad again) doesn't seem to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文