Mercurial > vim
changeset 15926:ca0a0b64809c v8.1.0969
patch 8.1.0969: message written during startup is truncated
commit https://github.com/vim/vim/commit/97c2c05ead689f4a5de986c82531fcbd09295cda
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 22 13:42:07 2019 +0100
patch 8.1.0969: message written during startup is truncated
Problem: Message written during startup is truncated.
Solution: Restore message after truncating. (closes 3969)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 22 Feb 2019 13:45:06 +0100 |
parents | 5e40c2b82a0f |
children | ea530928c116 |
files | src/message.c src/testdir/test_startup.vim src/version.c |
diffstat | 3 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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