diff --git a/application.py b/application.py index d1b5cb1..678365f 100755 --- a/application.py +++ b/application.py @@ -1185,10 +1185,12 @@ if __name__ == "__main__": curses.wrapper(run_app, buffers, **d) err = 0 except: + # restore terminal state before printing an error + termios.tcsetattr(sys.stdin, termios.TCSANOW, attr) traceback.print_exc() err = 1 - # restore terminal state + # restore terminal state before exiting termios.tcsetattr(sys.stdin, termios.TCSANOW, attr) ispell.free() sys.exit(err)