mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
fix(api): nvim_get_option_value does not clean up on FileType error #31219
Problem: If there's an error in `FileType` autocmd, the filetype get-opt buffer doesn't get cleaned up. Solution: Call `aucmd_restbuf`.
This commit is contained in:
@@ -161,6 +161,18 @@ describe('vim.filetype', function()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
it('.get_option() cleans up buffer on error', function()
|
||||
api.nvim_create_autocmd('FileType', { pattern = 'foo', command = 'lua error()' })
|
||||
|
||||
local buf = api.nvim_get_current_buf()
|
||||
|
||||
exec_lua(function()
|
||||
pcall(vim.filetype.get_option, 'foo', 'lisp')
|
||||
end)
|
||||
|
||||
eq(buf, api.nvim_get_current_buf())
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('filetype.lua', function()
|
||||
|
Reference in New Issue
Block a user