fix(messages): proper multiline Lua print() messages #31205

Problem:  Separate message emitted for each newline present in Lua
          print() arguments.
Solution: Make msg_multiline() handle NUL bytes. Refactor print() to use
          msg_multiline(). Refactor vim.print() to use print().
This commit is contained in:
luukvbaal
2024-11-17 19:21:50 +01:00
committed by GitHub
parent 6ea45031d5
commit e025f5a5b3
9 changed files with 64 additions and 77 deletions

View File

@@ -7881,7 +7881,7 @@ void ex_echo(exarg_T *eap)
char *tofree = encode_tv2echo(&rettv, NULL);
if (*tofree != NUL) {
msg_ext_set_kind("echo");
msg_multiline(tofree, echo_hl_id, true, false, &need_clear);
msg_multiline(cstr_as_string(tofree), echo_hl_id, true, false, &need_clear);
}
xfree(tofree);
}