mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(startup)!: "nvim -l" message does not end with newline #24215
Close #24180
This commit is contained in:
parent
ff8e3c6039
commit
db590e96d5
@ -38,6 +38,9 @@ The following changes may require adaptations in user config or plugins.
|
|||||||
• When switching windows, |CursorMoved| autocommands trigger when Nvim is back
|
• When switching windows, |CursorMoved| autocommands trigger when Nvim is back
|
||||||
in the main loop rather than immediately. This is more compatible with Vim.
|
in the main loop rather than immediately. This is more compatible with Vim.
|
||||||
|
|
||||||
|
• |-l| ensures output ends with a newline if the script prints messages and
|
||||||
|
doesn't cause Nvim to exit.
|
||||||
|
|
||||||
• |LspRequest| and LspProgressUpdate (renamed to |LspProgress|) autocmds were
|
• |LspRequest| and LspProgressUpdate (renamed to |LspProgress|) autocmds were
|
||||||
promoted from a |User| autocmd to first class citizen.
|
promoted from a |User| autocmd to first class citizen.
|
||||||
|
|
||||||
|
@ -227,6 +227,8 @@ argument.
|
|||||||
|
|
||||||
Sets 'verbose' to 1 (like "-V1"), so Lua `print()` writes to
|
Sets 'verbose' to 1 (like "-V1"), so Lua `print()` writes to
|
||||||
output.
|
output.
|
||||||
|
If {script} prints messages and doesn't cause Nvim to exit,
|
||||||
|
Nvim ensures output ends with a newline.
|
||||||
|
|
||||||
Arguments before "-l" are processed before executing {script}.
|
Arguments before "-l" are processed before executing {script}.
|
||||||
This example quits before executing "foo.lua": >
|
This example quits before executing "foo.lua": >
|
||||||
|
@ -633,6 +633,10 @@ int main(int argc, char **argv)
|
|||||||
msg_scroll = true;
|
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");
|
||||||
|
if (msg_didout) {
|
||||||
|
msg_putchar('\n');
|
||||||
|
msg_didout = false;
|
||||||
|
}
|
||||||
getout(lua_ok ? 0 : 1);
|
getout(lua_ok ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,12 +131,12 @@ describe('startup', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('executes stdin "-"', function()
|
it('executes stdin "-"', function()
|
||||||
assert_l_out('arg0=- args=2 whoa',
|
assert_l_out('arg0=- args=2 whoa\n',
|
||||||
nil,
|
nil,
|
||||||
{ 'arg1', 'arg 2' },
|
{ 'arg1', 'arg 2' },
|
||||||
'-',
|
'-',
|
||||||
"print(('arg0=%s args=%d %s'):format(_G.arg[0], #_G.arg, 'whoa'))")
|
"print(('arg0=%s args=%d %s'):format(_G.arg[0], #_G.arg, 'whoa'))")
|
||||||
assert_l_out('biiig input: 1000042',
|
assert_l_out('biiig input: 1000042\n',
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
'-',
|
'-',
|
||||||
@ -145,11 +145,12 @@ describe('startup', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('does not truncate long print() message', function()
|
it('does not truncate long print() message', function()
|
||||||
assert_l_out(('k'):rep(1234),
|
assert_l_out(('k'):rep(1234) .. '\n', nil, nil, '-', "print(('k'):rep(1234))")
|
||||||
nil,
|
end)
|
||||||
nil,
|
|
||||||
'-',
|
it('does not add newline when unnecessary', function()
|
||||||
"print(('k'):rep(1234))")
|
assert_l_out('', nil, nil, '-', '')
|
||||||
|
assert_l_out('foobar\n', nil, nil, '-', [[print('foobar\n')]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('sets _G.arg', function()
|
it('sets _G.arg', function()
|
||||||
@ -159,7 +160,8 @@ describe('startup', function()
|
|||||||
nvim args: 3
|
nvim args: 3
|
||||||
lua args: {
|
lua args: {
|
||||||
[0] = "test/functional/fixtures/startup.lua"
|
[0] = "test/functional/fixtures/startup.lua"
|
||||||
}]],
|
}
|
||||||
|
]],
|
||||||
{},
|
{},
|
||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
@ -171,7 +173,8 @@ describe('startup', function()
|
|||||||
nvim args: 7
|
nvim args: 7
|
||||||
lua args: { "-arg1", "--arg2", "--", "arg3",
|
lua args: { "-arg1", "--arg2", "--", "arg3",
|
||||||
[0] = "test/functional/fixtures/startup.lua"
|
[0] = "test/functional/fixtures/startup.lua"
|
||||||
}]],
|
}
|
||||||
|
]],
|
||||||
{},
|
{},
|
||||||
{ '-arg1', '--arg2', '--', 'arg3' }
|
{ '-arg1', '--arg2', '--', 'arg3' }
|
||||||
)
|
)
|
||||||
@ -183,7 +186,8 @@ describe('startup', function()
|
|||||||
nvim args: 10
|
nvim args: 10
|
||||||
lua args: { "-arg1", "arg 2", "--", "file3", "file4",
|
lua args: { "-arg1", "arg 2", "--", "file3", "file4",
|
||||||
[0] = "test/functional/fixtures/startup.lua"
|
[0] = "test/functional/fixtures/startup.lua"
|
||||||
}]],
|
}
|
||||||
|
]],
|
||||||
{ 'file1', 'file2', },
|
{ 'file1', 'file2', },
|
||||||
{ '-arg1', 'arg 2', '--', 'file3', 'file4' }
|
{ '-arg1', 'arg 2', '--', 'file3', 'file4' }
|
||||||
)
|
)
|
||||||
@ -195,7 +199,8 @@ describe('startup', function()
|
|||||||
nvim args: 5
|
nvim args: 5
|
||||||
lua args: { "-c", "set wrap?",
|
lua args: { "-c", "set wrap?",
|
||||||
[0] = "test/functional/fixtures/startup.lua"
|
[0] = "test/functional/fixtures/startup.lua"
|
||||||
}]],
|
}
|
||||||
|
]],
|
||||||
{},
|
{},
|
||||||
{ '-c', 'set wrap?' }
|
{ '-c', 'set wrap?' }
|
||||||
)
|
)
|
||||||
@ -211,7 +216,8 @@ describe('startup', function()
|
|||||||
nvim args: 7
|
nvim args: 7
|
||||||
lua args: { "-c", "set wrap?",
|
lua args: { "-c", "set wrap?",
|
||||||
[0] = "test/functional/fixtures/startup.lua"
|
[0] = "test/functional/fixtures/startup.lua"
|
||||||
}]],
|
}
|
||||||
|
]],
|
||||||
{ '-c', 'set wrap?' },
|
{ '-c', 'set wrap?' },
|
||||||
{ '-c', 'set wrap?' }
|
{ '-c', 'set wrap?' }
|
||||||
)
|
)
|
||||||
@ -219,7 +225,7 @@ describe('startup', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('disables swapfile/shada/config/plugins', function()
|
it('disables swapfile/shada/config/plugins', function()
|
||||||
assert_l_out('updatecount=0 shadafile=NONE loadplugins=false scripts=1',
|
assert_l_out('updatecount=0 shadafile=NONE loadplugins=false scripts=1\n',
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
'-',
|
'-',
|
||||||
|
Loading…
Reference in New Issue
Block a user