summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-22 13:42:07 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-22 13:42:07 +0100
commit97c2c05ead689f4a5de986c82531fcbd09295cda (patch)
tree50375633d0f13ead227f2cbfd1dc4a4dc61efeb7
parent527a2d86fb375fcc7b34e80fc47f4c7126fc12ba (diff)
patch 8.1.0969: message written during startup is truncatedv8.1.0969
Problem: Message written during startup is truncated. Solution: Restore message after truncating. (closes 3969)
-rw-r--r--src/message.c7
-rw-r--r--src/testdir/test_startup.vim10
-rw-r--r--src/version.c2
3 files changed, 19 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
index a7aca2b99c..d6acb09910 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2627,12 +2627,19 @@ msg_puts_printf(char_u *str, int maxlen)
if (*p != NUL && !(silent_mode && p_verbose == 0))
{
+ int c = -1;
+
if (maxlen > 0 && STRLEN(p) > (size_t)maxlen)
+ {
+ c = p[maxlen];
p[maxlen] = 0;
+ }
if (info_message)
mch_msg((char *)p);
else
mch_errmsg((char *)p);
+ if (c != -1)
+ p[maxlen] = c;
}
msg_didout = TRUE; // assume that line is not empty
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 16b202f85c..b7dd7eafdd 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -537,3 +537,13 @@ func Test_zzz_startinsert()
endif
call delete('Xtestout')
endfunc
+
+func Test_issue_3969()
+ if has('gui_running')
+ " Can't catch the output of gvim.
+ return
+ endif
+ " Check that message is not truncated.
+ let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq')
+ call assert_equal('hello', out)
+endfunc
diff --git a/src/version.c b/src/version.c
index 13f54e343d..cd45fa0189 100644
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 969,
+/**/
968,
/**/
967,