From 9e182722ccd2d51592cc894692159f6feefa8a37 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 19 May 2019 19:44:27 +0200 Subject: [PATCH] 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. --- src/nano.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nano.c b/src/nano.c index 750ff0dc..2524048e 100644 --- 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. */