Skip to content
Snippets Groups Projects
Verified Commit 768fe58f authored by Petr Špaček's avatar Petr Špaček
Browse files

tty: do not print extra newline after empty messages

In case nothing (not even nil) is returned then do not print newline
after the zero-length message. This avoids unambiguous empty line in
output (is it an empty string which got printed?).
parent 9fcab119
Branches
Tags
1 merge request!1027new pretty printer
......@@ -704,7 +704,7 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu
FILE *fp_out = ret ? stderr : stdout;
if (message)
fprintf(fp_out, "%s", message);
if (message || !args->quiet)
if (message && !args->quiet)
fprintf(fp_out, "\n");
fprintf(fp_out, "%s", delim);
}
......
......@@ -421,7 +421,7 @@ static int interact()
return 1;
}
printf("%s", msg);
if (msg_len == 0 || msg[msg_len - 1] != '\n') {
if (msg_len > 0 && msg[msg_len - 1] != '\n') {
printf("\n");
}
if (hist_file) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment