]> granicus.if.org Git - vim/commitdiff
patch 8.1.0969: message written during startup is truncated v8.1.0969
authorBram Moolenaar <Bram@vim.org>
Fri, 22 Feb 2019 12:42:07 +0000 (13:42 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 22 Feb 2019 12:42:07 +0000 (13:42 +0100)
Problem:    Message written during startup is truncated.
Solution:   Restore message after truncating. (closes 3969)

src/message.c
src/testdir/test_startup.vim
src/version.c

index a7aca2b99c2a0bffae53c5c5d988985468fe594f..d6acb0991006a00274fafbcf1199d7ac05648642 100644 (file)
@@ -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
index 16b202f85c0910b9d81324c21b137fe90471c091..b7dd7eafdd2703cfb9526146a411dccd45575d2a 100644 (file)
@@ -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
index 13f54e343d1bef811a12b041265283350ee26f3b..cd45fa01894fbb3faf6972826a2ae3ea59d5850f 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    969,
 /**/
     968,
 /**/