diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-01-11 20:04:32 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-11 20:04:32 +0800 |
| commit | 94144d46787fc396dd9e830f2cde5a09f2b4307d (patch) | |
| tree | dca4138cc06d072a595f7b4c012936adec12e566 /runtime/lua/vim/_core/shared.lua | |
| parent | cd0d26daf955056495086413ceb7f8967ecbf734 (diff) | |
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().
Diffstat (limited to 'runtime/lua/vim/_core/shared.lua')
| -rw-r--r-- | runtime/lua/vim/_core/shared.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/_core/shared.lua b/runtime/lua/vim/_core/shared.lua index 8dfca25fb9..1d1b64cb99 100644 --- a/runtime/lua/vim/_core/shared.lua +++ b/runtime/lua/vim/_core/shared.lua @@ -1473,13 +1473,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 |
