curses on unix - terminal reset needed after abort
Noticed while investigating the message loop. If I had level files from an interrupted game and was asked "Destroy old game?" when starting a new one, answering 'n' left the terminal in an unusable state. Executing 'stty sane' (invisibly since input echo was off) repaired things but the user shouldn't have to do that. Change unixtty.c's error() to shut down windowing if that has been initialized. This might need some tweaking for tty, which will now clear the screen before showing the startup error message. Other systems besides unix use unixtty.c so are affected, but I think the change doesn't introduce anything that should cause trouble (aside from the potential screen erasure).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 unixtty.c $NHDT-Date: 1548372343 2019/01/24 23:25:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */
|
||||
/* NetHack 3.6 unixtty.c $NHDT-Date: 1570652308 2019/10/09 20:18:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.26 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2006. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -243,6 +243,7 @@ const char *s;
|
||||
iflags.cbreak = (CBRKON(inittyb.cbrkflgs & CBRKMASK)) ? ON : OFF;
|
||||
curttyb.inputflags |= STRIPHI;
|
||||
setioctls();
|
||||
settty_needed = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -471,6 +472,9 @@ VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
|
||||
if (iflags.window_inited)
|
||||
exit_nhwindows((char *) 0); /* for tty, will call settty() */
|
||||
if (settty_needed)
|
||||
settty((char *) 0);
|
||||
Vprintf(s, VA_ARGS);
|
||||
|
||||
Reference in New Issue
Block a user