c - 从中​​ncurses的去UI外部程序和背部 [英] C - going from ncurses ui to external program and back

查看:93
本文介绍了c - 从中​​ncurses的去UI外部程序和背部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个显示ncurses的一些信息的程序,然后打开VIM(使用系统),以允许用户编辑文件。 VIM退出后,虽然,ncurses的屏幕将不会重绘。 刷新 wrefresh 不做任何事情,导致我美丽的菜单完全捣毁。

I'm making a program that displays some info in ncurses, and then opens vim (using system) to allow the user to edit a file. After vim is exited, though, the ncurses screen won't redraw. refresh and wrefresh don't do anything, resulting in the complete trashing of my beautiful menu.

所以,我送回到命令行。当我移动到它们的菜单项重绘。逛了一下结果朝着东西看起来是这样的:

So, I get sent back to the command line. The menu items redraw when I move to them. Moving around a bit results in something that looks like this:

正如你所看到的,我不再在我的pretty ncurses的环境。

As you can see, I no longer am in my pretty ncurses environment,.

我可以彻底推倒的ncurses并重新设置的东西,但后来的一些东西(如菜单位置)不是preserved。

I could tear down ncurses completely and set things up again, but then some stuff (like menu position) is not preserved.

我如何做正确的?有没有更好的方式来调用一些外部程序,并优雅地回到这里?

How do I do this correctly? Is there a better way to call some external program and return here gracefully?

推荐答案

我从来没有完全重新启动诅咒。

I've never had to restart curses entirely.

如果你做这样的事情。

def_prog_mode()然后
endwin()

执行系统调用

和刷新()应该恢复它

这篇关于c - 从中​​ncurses的去UI外部程序和背部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆