commit 9e182722ccd2d51592cc894692159f6feefa8a37
parent 4f1eb5fdd4f9962961f59c36a97895e51fadd63f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 19 May 2019 19:44:27 +0200
feedback: print helpful message only when data comes from keyboard
When the data is fed to nano through a pipe, it is pointless to print
this message as it can be seen only after nano has exited.
This addresses https://savannah.gnu.org/bugs/?56348.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1065,8 +1065,10 @@ bool scoop_stdin(void)
endwin();
tcsetattr(0, TCSANOW, &oldterm);
- fprintf(stderr, _("Reading from standard input; type ^D or ^D^D to finish.\n"));
-
+ /* When input comes from a terminal, show a helpful message. */
+ if (isatty(0))
+ fprintf(stderr, _("Reading data from keyboard; "
+ "type ^D or ^D^D to finish.\n"));
#ifndef NANO_TINY
/* Enable interpretation of the special control keys so that
* we get SIGINT when Ctrl-C is pressed. */