Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C - going from ncurses ui to external program and back

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:

Tragedy

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

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?

like image 250
ty. Avatar asked Nov 14 '22 09:11

ty.


1 Answers

I've never had to restart curses entirely.

what if you do something like

def_prog_mode() then endwin()

execute system call

and refresh() should restore it

like image 170
Tree77 Avatar answered Dec 11 '22 08:12

Tree77