mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(startup): don't truncate when printing with -l (#24216)
This commit is contained in:
@@ -629,6 +629,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params.luaf != NULL) {
|
if (params.luaf != NULL) {
|
||||||
|
// Like "--cmd", "+", "-c" and "-S", don't truncate messages.
|
||||||
|
msg_scroll = true;
|
||||||
bool lua_ok = nlua_exec_file(params.luaf);
|
bool lua_ok = nlua_exec_file(params.luaf);
|
||||||
TIME_MSG("executing Lua -l script");
|
TIME_MSG("executing Lua -l script");
|
||||||
getout(lua_ok ? 0 : 1);
|
getout(lua_ok ? 0 : 1);
|
||||||
|
@@ -107,6 +107,7 @@ describe('Remote', function()
|
|||||||
eq({ '0', '' }, run_remote('--remote-expr', 'setline(1, "Yo")'))
|
eq({ '0', '' }, run_remote('--remote-expr', 'setline(1, "Yo")'))
|
||||||
eq({ 'Yo', '' }, run_remote('--remote-expr', 'getline(1)'))
|
eq({ 'Yo', '' }, run_remote('--remote-expr', 'getline(1)'))
|
||||||
expect('Yo')
|
expect('Yo')
|
||||||
|
eq({ ('k'):rep(1234), '' }, run_remote('--remote-expr', 'repeat("k", 1234)'))
|
||||||
eq({ '1.25', '' }, run_remote('--remote-expr', '1.25'))
|
eq({ '1.25', '' }, run_remote('--remote-expr', '1.25'))
|
||||||
eq({ 'no', '' }, run_remote('--remote-expr', '0z6E6F'))
|
eq({ 'no', '' }, run_remote('--remote-expr', '0z6E6F'))
|
||||||
eq({ '\t', '' }, run_remote('--remote-expr', '"\t"'))
|
eq({ '\t', '' }, run_remote('--remote-expr', '"\t"'))
|
||||||
|
@@ -101,10 +101,11 @@ describe('startup', function()
|
|||||||
it('os.exit() sets Nvim exitcode', function()
|
it('os.exit() sets Nvim exitcode', function()
|
||||||
-- tricky: LeakSanitizer triggers on os.exit() and disrupts the return value, disable it
|
-- tricky: LeakSanitizer triggers on os.exit() and disrupts the return value, disable it
|
||||||
exec_lua [[
|
exec_lua [[
|
||||||
local asan_options = os.getenv 'ASAN_OPTIONS'
|
local asan_options = os.getenv('ASAN_OPTIONS') or ''
|
||||||
if asan_options ~= nil and asan_options ~= '' then
|
if asan_options ~= '' then
|
||||||
vim.uv.os_setenv('ASAN_OPTIONS', asan_options..':detect_leaks=0')
|
asan_options = asan_options .. ':'
|
||||||
end
|
end
|
||||||
|
vim.uv.os_setenv('ASAN_OPTIONS', asan_options .. ':detect_leaks=0')
|
||||||
]]
|
]]
|
||||||
-- nvim -l foo.lua -arg1 -- a b c
|
-- nvim -l foo.lua -arg1 -- a b c
|
||||||
assert_l_out([[
|
assert_l_out([[
|
||||||
@@ -143,6 +144,14 @@ describe('startup', function()
|
|||||||
eq(0, eval('v:shell_error'))
|
eq(0, eval('v:shell_error'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not truncate long print() message', function()
|
||||||
|
assert_l_out(('k'):rep(1234),
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
'-',
|
||||||
|
"print(('k'):rep(1234))")
|
||||||
|
end)
|
||||||
|
|
||||||
it('sets _G.arg', function()
|
it('sets _G.arg', function()
|
||||||
-- nvim -l foo.lua
|
-- nvim -l foo.lua
|
||||||
assert_l_out([[
|
assert_l_out([[
|
||||||
@@ -219,6 +228,15 @@ describe('startup', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('--cmd/-c/+ do not truncate long Lua print() message with --headless', function()
|
||||||
|
local out = funcs.system({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless',
|
||||||
|
'--cmd', 'lua print(("A"):rep(1234))',
|
||||||
|
'-c', 'lua print(("B"):rep(1234))',
|
||||||
|
'+lua print(("C"):rep(1234))',
|
||||||
|
'+q' })
|
||||||
|
eq(('A'):rep(1234) .. '\r\n' .. ('B'):rep(1234) .. '\r\n' .. ('C'):rep(1234), out)
|
||||||
|
end)
|
||||||
|
|
||||||
it('pipe at both ends: has("ttyin")==0 has("ttyout")==0', function()
|
it('pipe at both ends: has("ttyin")==0 has("ttyout")==0', function()
|
||||||
-- system() puts a pipe at both ends.
|
-- system() puts a pipe at both ends.
|
||||||
local out = funcs.system({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless',
|
local out = funcs.system({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless',
|
||||||
|
Reference in New Issue
Block a user