diff options
author | Michael Schupikov <michael@schupikov.de> | 2017-01-15 11:24:01 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-01-16 01:23:48 +0100 |
commit | 95a4244587ef8e474da53f4a3d21ec3055746211 (patch) | |
tree | a4b667f1e417ae2ff2f78b953501de4fdba16964 | |
parent | 3ba5e43d2e3baec1f7e74e2dce7ad340c47c26ad (diff) | |
download | rneovim-95a4244587ef8e474da53f4a3d21ec3055746211.tar.gz rneovim-95a4244587ef8e474da53f4a3d21ec3055746211.tar.bz2 rneovim-95a4244587ef8e474da53f4a3d21ec3055746211.zip |
readfile(): Avoid file message when reading from stdin. #5956
Closes #5921
-rw-r--r-- | src/nvim/fileio.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index e734cde905..a9f2d625cf 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -281,7 +281,7 @@ readfile ( int wasempty; /* buffer was empty before reading */ colnr_T len; long size = 0; - char_u *p; + char_u *p = NULL; off_t filesize = 0; int skip_read = FALSE; context_sha256_T sha_ctx; @@ -1883,16 +1883,20 @@ failed: xfree(keep_msg); keep_msg = NULL; msg_scrolled_ign = TRUE; - p = msg_trunc_attr(IObuff, FALSE, 0); + + if (!read_stdin && !read_buffer) { + p = msg_trunc_attr(IObuff, FALSE, 0); + } + if (read_stdin || read_buffer || restart_edit != 0 - || (msg_scrolled != 0 && !need_wait_return)) - /* Need to repeat the message after redrawing when: - * - When reading from stdin (the screen will be cleared next). - * - When restart_edit is set (otherwise there will be a delay - * before redrawing). - * - When the screen was scrolled but there is no wait-return - * prompt. */ + || (msg_scrolled != 0 && !need_wait_return)) { + // Need to repeat the message after redrawing when: + // - When reading from stdin (the screen will be cleared next). + // - When restart_edit is set (otherwise there will be a delay before + // redrawing). + // - When the screen was scrolled but there is no wait-return prompt. set_keep_msg(p, 0); + } msg_scrolled_ign = FALSE; } |