redo tty resizing
Rest of 'not PR #1102'. Resizing the terminal while getpos was in operation recalculated the map from scratch instead of redrawing what the core considers to already be shown. And it was always operating while an asynchronous signal was excuting which could potentially clobber whatever was running at the time the signal arrived. This uses same redrawing as the prior '^R during getpos()' fix. It also only performs the resize while tty_nhgetch() is waiting for input. If that is the situation at the time that the signal arrives then it will resize immediately (while in the asynchronous signal handler); if not, it will set a flag and tty_nhgetch() will do the resize the next time it gets called. This builds with TTY_PERM_INVENT enabled and doesn't seem to be any worse than before, but there are bugs with that. The only way I could get perminv to appear was to save and restore, then perm_invent was honored for both RC file and mO command. And once I managed to get it to display, moving an item from a lower case slot to slot 'A', made that item vanish; nothing appeared in the invent's right hand panel. Both of those misbehaviors already happen prior to this commit. I also saw an abort+panictrace if I resized while at the "Dump core?" prompt when running the pre-commit code and didn't see that with the post-commit code (although the prompt wasn't shown so I couldn't tell that it was waiting for an answer). The abort probably sounds scarier than it warrants; I suspect that the pre-commit code just treated the resize as answering 'y' for some reason, possibly a stale value in the variable it uses.
This commit is contained in:
@@ -775,6 +775,13 @@ struct sinfo {
|
||||
interface to suppress menu commands in similar conditions;
|
||||
readchar() alrways resets it to 'otherInp' prior to returning */
|
||||
int input_state; /* whether next key pressed will be entering a command */
|
||||
#ifdef TTY_GRAPHICS
|
||||
/* resize_pending only matters when handling a SIGWINCH signal for tty;
|
||||
getting_char is used along with that and also separately for UNIX;
|
||||
we minimize #if conditionals for them to avoid unnecessary clutter */
|
||||
volatile int resize_pending; /* set by signal handler */
|
||||
volatile int getting_char; /* referenced during signal handling */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* value of program_state.input_state, significant during readchar();
|
||||
|
||||
Reference in New Issue
Block a user