mirror of
https://github.com/neovim/neovim.git
synced 2025-09-10 13:28:19 +00:00
fix(lua): always use vim.inspect() for :lua= (#32715)
This commit is contained in:
@@ -1668,13 +1668,13 @@ void ex_lua(exarg_T *const eap)
|
||||
|
||||
// ":lua {code}", ":={expr}" or ":lua ={expr}"
|
||||
//
|
||||
// When "=expr" is used transform it to "vim.print(expr)".
|
||||
// When "=expr" is used transform it to "vim._print(true, expr)".
|
||||
if (eap->cmdidx == CMD_equal || code[0] == '=') {
|
||||
size_t off = (eap->cmdidx == CMD_equal) ? 0 : 1;
|
||||
len += sizeof("vim.print()") - 1 - off;
|
||||
len += sizeof("vim._print(true, )") - 1 - off;
|
||||
// `nlua_typval_exec` doesn't expect NUL-terminated string so `len` must end before NUL byte.
|
||||
char *code_buf = xmallocz(len);
|
||||
vim_snprintf(code_buf, len + 1, "vim.print(%s)", code + off);
|
||||
vim_snprintf(code_buf, len + 1, "vim._print(true, %s)", code + off);
|
||||
xfree(code);
|
||||
code = code_buf;
|
||||
}
|
||||
|
Reference in New Issue
Block a user