tweaks: frob a few comments, and elide and #ifndef

master
Benno Schulenberg 2017-06-06 17:57:15 +02:00
parent 84cd0abd6f
commit 6807e06a74
1 changed files with 8 additions and 15 deletions

View File

@ -1172,7 +1172,7 @@ void stdin_pager(void)
finish_stdin_pager(); finish_stdin_pager();
} }
/* Initialize the signal handlers. */ /* Register half a dozen signal handlers. */
void signal_init(void) void signal_init(void)
{ {
/* Trap SIGINT and SIGQUIT because we want them to do useful things. */ /* Trap SIGINT and SIGQUIT because we want them to do useful things. */
@ -1196,12 +1196,12 @@ void signal_init(void)
sigaction(SIGWINCH, &act, NULL); sigaction(SIGWINCH, &act, NULL);
#endif #endif
/* Trap a normal suspend (^Z) so we can handle it ourselves. */
if (ISSET(SUSPEND)) { if (ISSET(SUSPEND)) {
/* Block all other signals in the suspend and continue handlers. /* Block all other signals in the suspend and continue handlers.
* If we don't do this, other stuff interrupts them! */ * If we don't do this, other stuff interrupts them! */
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
#ifdef SIGTSTP #ifdef SIGTSTP
/* Trap a normal suspend (^Z) so we can handle it ourselves. */
act.sa_handler = do_suspend; act.sa_handler = do_suspend;
sigaction(SIGTSTP, &act, NULL); sigaction(SIGTSTP, &act, NULL);
#endif #endif
@ -1247,7 +1247,7 @@ RETSIGTYPE do_suspend(int signal)
#endif #endif
} }
/* The version of above function that is bound to a key. */ /* Put nano to sleep (if suspension is enabled). */
void do_suspend_void(void) void do_suspend_void(void)
{ {
if (ISSET(SUSPEND)) if (ISSET(SUSPEND))
@ -1270,7 +1270,7 @@ RETSIGTYPE do_continue(int signal)
/* Perhaps the user resized the window while we slept. */ /* Perhaps the user resized the window while we slept. */
the_window_resized = TRUE; the_window_resized = TRUE;
#else #else
/* Restore the state of the terminal. */ /* Put the terminal in the desired state again. */
terminal_init(); terminal_init();
#endif #endif
/* Tickle the input routine so it will update the screen. */ /* Tickle the input routine so it will update the screen. */
@ -1326,21 +1326,16 @@ void regenerate_screen(void)
SLsmg_reset_smg(); SLsmg_reset_smg();
SLsmg_init_smg(); SLsmg_init_smg();
#else #else
/* Do the equivalent of what Minimum Profit does: Leave and /* Do the equivalent of what Minimum Profit does: leave and immediately
* immediately reenter curses mode. */ * reenter curses mode. */
endwin(); endwin();
doupdate(); doupdate();
#endif #endif
/* Restore the terminal to its previous state. */ /* Put the terminal in the desired state again, recreate the subwindows
* with their (new) sizes, and redraw the contents of these windows. */
terminal_init(); terminal_init();
/* Do the equivalent of what both mutt and Minimum Profit do:
* Reinitialize all the windows based on the new screen
* dimensions. */
window_init(); window_init();
/* Redraw the contents of the windows that need it. */
total_refresh(); total_refresh();
} }
@ -1354,9 +1349,7 @@ void allow_sigwinch(bool allow)
sigaddset(&winch, SIGWINCH); sigaddset(&winch, SIGWINCH);
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL); sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
} }
#endif /* !NANO_TINY */
#ifndef NANO_TINY
/* Handle the global toggle specified in flag. */ /* Handle the global toggle specified in flag. */
void do_toggle(int flag) void do_toggle(int flag)
{ {