From e39938c1fa378405b95efd49b1e53efde0b6f335 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 11 Feb 2016 16:57:52 +0000 Subject: [PATCH] Not leaving curses mode in the formatter, as that would hide error messages upon reentry. And, if there are any messages, allowing the user a little time to read them. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5632 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/text.c | 16 ++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ff6b107..5b6543ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2016-02-11 Benno Schulenberg * src/text.c (do_linter): Go to the next item in the list before freeing the current one. This fixes Savannah bug #46796. + * src/text.c (do_formatter): Don't leave curses mode, as that would + hide any error messages upon reentry. And if there are any messages, + allow the user a little time to read them. 2016-02-10 Benno Schulenberg * src/text.c (discard_until): Prevent a chain of editing actions from diff --git a/src/text.c b/src/text.c index 6cec9430..70c25d72 100644 --- a/src/text.c +++ b/src/text.c @@ -3254,8 +3254,6 @@ void do_formatter(void) blank_bottombars(); statusbar(_("Invoking formatter, please wait")); - endwin(); - /* Set up an argument list to pass to execvp(). */ if (formatargs == NULL) { formatargs = (char **)nmalloc(arglen * sizeof(char *)); @@ -3296,12 +3294,6 @@ void do_formatter(void) /* Wait for the formatter to finish. */ wait(&format_status); - /* Reenter curses mode. */ - doupdate(); - - /* Restore the terminal to its previous state. */ - terminal_init(); - if (!WIFEXITED(format_status) || WEXITSTATUS(format_status) != 0) finalstatus = invocation_error(openfile->syntax->formatter); else { @@ -3327,11 +3319,15 @@ void do_formatter(void) allow_sigwinch(TRUE); #endif + statusbar(finalstatus); + + /* If there were error messages, allow the user some time to read them. */ + if (WIFEXITED(format_status) && WEXITSTATUS(format_status) == 2) + sleep(4); + /* If the formatter printed any error messages onscreen, make * sure that they're cleared off. */ total_refresh(); - - statusbar(finalstatus); } #endif /* !DISABLE_SPELLER */ #endif /* !DISABLE_COLOR */ -- 2.39.5