mirror of
https://github.com/neovim/neovim.git
synced 2026-02-22 10:22:17 +10:00
fix(lua): vim._with() doesn't save boolean options properly (#37354)
Problem: vim._with() doesn't save boolean options with false values
properly.
Solution: Use vim.F.if_nil().
(cherry picked from commit 94144d4678)
This commit is contained in:
committed by
github-actions[bot]
parent
2a3cd8dc80
commit
f21c169a02
@@ -1277,13 +1277,13 @@ local get_context_state = function(context)
|
||||
|
||||
-- Do not override already set state and fall back to `vim.NIL` for
|
||||
-- state `nil` values (which still needs restoring later)
|
||||
res[sc][name] = res[sc][name] or vim[sc][name] or vim.NIL
|
||||
res[sc][name] = vim.F.if_nil(res[sc][name], vim[sc][name], vim.NIL)
|
||||
|
||||
-- Always track global option value to properly restore later.
|
||||
-- This matters for at least `o` and `wo` (which might set either/both
|
||||
-- local and global option values).
|
||||
if sc ~= 'env' then
|
||||
res.go[name] = res.go[name] or vim.go[name]
|
||||
if sc ~= 'env' and res.go[name] == nil then
|
||||
res.go[name] = vim.go[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user