mirror of
https://https.git.savannah.gnu.org/git/nano.git
synced 2026-01-26 16:09:15 +00:00
startup: register the handler for SIGWINCH much earlier
Otherwise nano is deaf for SIGWINCHes during several milliseconds, which can cause it to start off with wrong dimensions. This fixes the second part of https://savannah.gnu.org/bugs/?67635. The issue was reported, and the solution suggested, by `twofiftysix`. Buglet has existed for a long time.
This commit is contained in:
parent
c11569fb99
commit
6136b28af7
20
src/nano.c
20
src/nano.c
@ -903,6 +903,17 @@ bool scoop_stdin(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Register a handler for SIGWINCH because we want to handle window resizes. */
|
||||
void set_up_sigwinch_handler(void)
|
||||
{
|
||||
#ifdef SIGWINCH
|
||||
struct sigaction deed = {{0}};
|
||||
|
||||
deed.sa_handler = handle_sigwinch;
|
||||
sigaction(SIGWINCH, &deed, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Register half a dozen signal handlers. */
|
||||
void signal_init(void)
|
||||
{
|
||||
@ -923,11 +934,6 @@ void signal_init(void)
|
||||
sigaction(SIGTERM, &deed, NULL);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#ifdef SIGWINCH
|
||||
/* Trap SIGWINCH because we want to handle window resizes. */
|
||||
deed.sa_handler = handle_sigwinch;
|
||||
sigaction(SIGWINCH, &deed, NULL);
|
||||
#endif
|
||||
#ifdef SIGTSTP
|
||||
/* Prevent the suspend handler from getting interrupted. */
|
||||
sigfillset(&deed.sa_mask);
|
||||
@ -2154,6 +2160,10 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
set_up_sigwinch_handler();
|
||||
#endif
|
||||
|
||||
/* Curses needs TERM; if it is unset, try falling back to a VT220. */
|
||||
if (getenv("TERM") == NULL)
|
||||
putenv("TERM=vt220");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user