mirror of
https://github.com/neovim/neovim
synced 2025-07-16 17:21:49 +00:00
fix(startup): avoid crash with completion from -l script (#32160)
Related #27764
This commit is contained in:
@ -177,14 +177,11 @@ bool default_grid_alloc(void)
|
|||||||
resizing = true;
|
resizing = true;
|
||||||
|
|
||||||
// Allocation of the screen buffers is done only when the size changes and
|
// Allocation of the screen buffers is done only when the size changes and
|
||||||
// when Rows and Columns have been set and we have started doing full
|
// when Rows and Columns have been set.
|
||||||
// screen stuff.
|
|
||||||
if ((default_grid.chars != NULL
|
if ((default_grid.chars != NULL
|
||||||
&& Rows == default_grid.rows
|
&& Rows == default_grid.rows
|
||||||
&& Columns == default_grid.cols)
|
&& Columns == default_grid.cols)
|
||||||
|| Rows == 0
|
|| Rows == 0 || Columns == 0) {
|
||||||
|| Columns == 0
|
|
||||||
|| (!full_screen && default_grid.chars == NULL)) {
|
|
||||||
resizing = false;
|
resizing = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
setbuf(stdout, NULL); // NOLINT(bugprone-unsafe-functions)
|
setbuf(stdout, NULL); // NOLINT(bugprone-unsafe-functions)
|
||||||
|
|
||||||
full_screen = !silent_mode || exmode_active;
|
full_screen = !silent_mode;
|
||||||
|
|
||||||
// Set the default values for the options that use Rows and Columns.
|
// Set the default values for the options that use Rows and Columns.
|
||||||
win_init_size();
|
win_init_size();
|
||||||
|
@ -67,12 +67,22 @@ describe('command-line option', function()
|
|||||||
eq(#'100500\n', attrs.size)
|
eq(#'100500\n', attrs.size)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('does not crash when run completion in Ex mode', function()
|
it('does not crash when running completion in Ex mode', function()
|
||||||
local p =
|
local p =
|
||||||
n.spawn_wait('--clean', '-e', '-s', '--cmd', 'exe "norm! i\\<C-X>\\<C-V>"', '--cmd', 'qa!')
|
n.spawn_wait('--clean', '-e', '-s', '--cmd', 'exe "norm! i\\<C-X>\\<C-V>"', '--cmd', 'qa!')
|
||||||
eq(0, p.status)
|
eq(0, p.status)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not crash when running completion from -l script', function()
|
||||||
|
local lua_fname = 'Xinscompl.lua'
|
||||||
|
write_file(lua_fname, [=[vim.cmd([[exe "norm! i\<C-X>\<C-V>"]])]=])
|
||||||
|
finally(function()
|
||||||
|
os.remove(lua_fname)
|
||||||
|
end)
|
||||||
|
local p = n.spawn_wait('--clean', '-l', lua_fname)
|
||||||
|
eq(0, p.status)
|
||||||
|
end)
|
||||||
|
|
||||||
it('does not crash after reading from stdin in non-headless mode', function()
|
it('does not crash after reading from stdin in non-headless mode', function()
|
||||||
skip(is_os('win'))
|
skip(is_os('win'))
|
||||||
local screen = Screen.new(40, 8)
|
local screen = Screen.new(40, 8)
|
||||||
|
Reference in New Issue
Block a user