mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
[Backport release-0.8] fix(lua): assert failure with vim.regex() error inside :silent! (#20560)
Co-authored-by: Rustum Zia <ziarustum@gmail.com> Co-authored-by: RZia <36330543+grassdne@users.noreply.github.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
![41898282+github-actions[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
2ad8d36b89
commit
126e434fec
@@ -304,8 +304,10 @@ int nlua_regex(lua_State *lstate)
|
||||
nlua_push_errstr(lstate, "couldn't parse regex: %s", err.msg);
|
||||
api_clear_error(&err);
|
||||
return lua_error(lstate);
|
||||
} else if (prog == NULL) {
|
||||
nlua_push_errstr(lstate, "couldn't parse regex");
|
||||
return lua_error(lstate);
|
||||
}
|
||||
assert(prog);
|
||||
|
||||
regprog_T **p = lua_newuserdata(lstate, sizeof(regprog_T *));
|
||||
*p = prog;
|
||||
|
@@ -24,6 +24,7 @@ local rmdir = helpers.rmdir
|
||||
local write_file = helpers.write_file
|
||||
local expect_exit = helpers.expect_exit
|
||||
local poke_eventloop = helpers.poke_eventloop
|
||||
local assert_alive = helpers.assert_alive
|
||||
|
||||
describe('lua stdlib', function()
|
||||
before_each(clear)
|
||||
@@ -2210,6 +2211,10 @@ describe('lua stdlib', function()
|
||||
eq({3,7}, exec_lua[[return {re1:match_line(0, 1, 1, 8)}]])
|
||||
eq({}, exec_lua[[return {re1:match_line(0, 1, 1, 7)}]])
|
||||
eq({0,3}, exec_lua[[return {re1:match_line(0, 1, 0, 7)}]])
|
||||
|
||||
-- vim.regex() error inside :silent! should not crash. #20546
|
||||
command([[silent! lua vim.regex('\\z')]])
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
it('vim.defer_fn', function()
|
||||
|
Reference in New Issue
Block a user