commit bff6a905af77d4714650195374789544fa3b1bf1
parent c7f5691637e0bee7bf7ad3561f614620a0860447
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 28 Jul 2015 19:39:34 +0000
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
Diffstat:
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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>
* src/search.c (do_replace_loop): When doing regex replacements, find
each zero-length match only once. This fixes Savannah bug #45626.
diff --git a/src/nano.c b/src/nano.c
@@ -1396,12 +1396,13 @@ void regenerate_screen(void)
total_refresh();
}
-/* If allow is TRUE, block any SIGWINCH signals that we get, so that we
- * can deal with them later. If allow is FALSE, unblock any SIGWINCH
+/* If allow is FALSE, block any SIGWINCH signals that we get, so that
+ * 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. */
void allow_pending_sigwinch(bool allow)
{
sigset_t winch;
+
sigemptyset(&winch);
sigaddset(&winch, SIGWINCH);
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
diff --git a/src/text.c b/src/text.c
@@ -3292,8 +3292,8 @@ void do_formatter(void)
}
#ifndef NANO_TINY
- /* Don't handle a pending SIGWINCH until the alternate format checker
- * is finished and we've loaded the format-checked file back in. */
+ /* Don't handle any SIGWINCHes until the formatter has finished and
+ * we've loaded the reformatted file back in. */
allow_pending_sigwinch(FALSE);
#endif
@@ -3323,17 +3323,17 @@ void do_formatter(void)
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
set_modified();
-#ifndef NANO_TINY
- /* Handle a pending SIGWINCH again. */
- allow_pending_sigwinch(TRUE);
-#endif
-
finalstatus = _("Finished formatting");
}
unlink(temp);
free(temp);
+#ifndef NANO_TINY
+ /* Handle SIGWINCHes again. */
+ allow_pending_sigwinch(TRUE);
+#endif
+
/* If the formatter printed any error messages onscreen, make
* sure that they're cleared off. */
total_refresh();