Reenabling SIGWINCH-es also when invocation of the formatter fails,

and correcting some comments.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5324 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2015-07-28 19:39:34 +00:00
parent c7f5691637
commit bff6a905af
3 changed files with 15 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2015-07-28 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_formatter), src/nano.c (allow_pending_sigwinch):
Reenable SIGWINCH-es also when invoking the formatter fails, and
correct some comments.
2015-07-26 Benno Schulenberg <bensberg@justemail.net> 2015-07-26 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): When doing regex replacements, find * src/search.c (do_replace_loop): When doing regex replacements, find
each zero-length match only once. This fixes Savannah bug #45626. each zero-length match only once. This fixes Savannah bug #45626.

View File

@ -1396,12 +1396,13 @@ void regenerate_screen(void)
total_refresh(); total_refresh();
} }
/* If allow is TRUE, block any SIGWINCH signals that we get, so that we /* If allow is FALSE, block any SIGWINCH signals that we get, so that
* can deal with them later. If allow is FALSE, unblock any SIGWINCH * we can deal with them later. If allow is TRUE, unblock any SIGWINCH
* signals that we have, so that we can deal with them now. */ * signals that we have, so that we can deal with them now. */
void allow_pending_sigwinch(bool allow) void allow_pending_sigwinch(bool allow)
{ {
sigset_t winch; sigset_t winch;
sigemptyset(&winch); sigemptyset(&winch);
sigaddset(&winch, SIGWINCH); sigaddset(&winch, SIGWINCH);
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL); sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);

View File

@ -3292,8 +3292,8 @@ void do_formatter(void)
} }
#ifndef NANO_TINY #ifndef NANO_TINY
/* Don't handle a pending SIGWINCH until the alternate format checker /* Don't handle any SIGWINCHes until the formatter has finished and
* is finished and we've loaded the format-checked file back in. */ * we've loaded the reformatted file back in. */
allow_pending_sigwinch(FALSE); allow_pending_sigwinch(FALSE);
#endif #endif
@ -3323,17 +3323,17 @@ void do_formatter(void)
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save); do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
set_modified(); set_modified();
#ifndef NANO_TINY
/* Handle a pending SIGWINCH again. */
allow_pending_sigwinch(TRUE);
#endif
finalstatus = _("Finished formatting"); finalstatus = _("Finished formatting");
} }
unlink(temp); unlink(temp);
free(temp); free(temp);
#ifndef NANO_TINY
/* Handle SIGWINCHes again. */
allow_pending_sigwinch(TRUE);
#endif
/* If the formatter printed any error messages onscreen, make /* If the formatter printed any error messages onscreen, make
* sure that they're cleared off. */ * sure that they're cleared off. */
total_refresh(); total_refresh();