Clean up ncurses mess in terminal after a crash

Viewed 13236

I am drawing a TUI using ncurses. The trouble is that whenever my program gets seg-fault, my terminal is left in mess. I can not see what I am typing. Its a pain since I am working over ssh. I have mitigated some of the effect by using screen.

I would like to know if there is a command which will refresh my terminal after seg-fault in ncurses so that my terminal starts behaving normally.

5 Answers

I had this problem recently on a Mac OSX terminal. Following set of commands worked whereas stty sane did not.

stty discard '^O'
stty dsusp '^Y'
stty eof '^D'
stty eol '^@'
stty eol2 '^@'
stty erase '^?'
stty intr '^C'
stty kill '^U'
stty lnext '^V'
stty min 1
stty quit '^\'
stty reprint '^R'
stty start '^Q'
stty status '^T'
stty stop '^S'
stty susp '^Z'
stty time 0
stty werase '^W'
Related