commit 2b9f06194fb41fffe95e1af68b1e2788c074a895
parent 631defb8b21697d11e1ab5bf649555584de3180b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 25 Oct 2019 19:02:07 +0200
formatter: don't let output from the program pollute the screen
Run the formatting program outside of curses mode, so that any output
(complaints) that it produces will be on the terminal after exiting
from nano -- at least on a terminal emulator, not on a Linux VT.
This also allows the formatter to be an interactive program.
The disadvantage is that the screen flickers when typing M-F.
This fixes https://savannah.gnu.org/bugs/?57104.
Diffstat:
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -2565,9 +2565,8 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
if (fileinfo.st_size == 0)
return NULL;
- /* The spell checker needs the screen, so exit from curses mode. */
- if (spelling)
- endwin();
+ /* Exit from curses mode to give the program control of the terminal. */
+ endwin();
construct_argument_list(&arguments, theprogram, tempfile_name);
@@ -2586,11 +2585,9 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
wait(&program_status);
block_sigwinch(FALSE);
- /* When needed, restore the terminal state and reenter curses mode. */
- if (spelling) {
- terminal_init();
- doupdate();
- }
+ /* Restore the terminal state and reenter curses mode. */
+ terminal_init();
+ doupdate();
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) > 2)
return invocation_error(theprogram);