aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_meta.lua
diff options
context:
space:
mode:
authorckipp01 <ckipp@pm.me>2021-05-30 13:08:43 +0200
committerTJ DeVries <devries.timothyj@gmail.com>2021-06-29 08:42:07 -0400
commite6175f6389ea3fdc685fe2158948d49caa8cdba2 (patch)
treed547e7f41031df28fe8c4b6f99c37baab377f716 /runtime/lua/vim/_meta.lua
parent1d3ee1c44186c211611abd03bdb4e38004b14ff4 (diff)
downloadrneovim-e6175f6389ea3fdc685fe2158948d49caa8cdba2.tar.gz
rneovim-e6175f6389ea3fdc685fe2158948d49caa8cdba2.tar.bz2
rneovim-e6175f6389ea3fdc685fe2158948d49caa8cdba2.zip
fix(vim.opt): Get window options before setting.
This closes #14677, but I also am a little unsure if there are times where this may not be correct. However, this just changes the behavior that even if `was_set` was false, we still get for `nvim_win_get_option`.
Diffstat (limited to 'runtime/lua/vim/_meta.lua')
-rw-r--r--runtime/lua/vim/_meta.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index 85861420aa..c3f3bf66d3 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -209,12 +209,17 @@ local function get_scoped_option(k, set_type)
end
if is_window_option(info) then
- if vim.api.nvim_get_option_info(k).was_set then
- local was_set, value = pcall(a.nvim_win_get_option, 0, k)
- if was_set then return value end
+ local ok, value = pcall(a.nvim_win_get_option, 0, k)
+ if ok then
+ return value
end
- return a.nvim_get_option(k)
+ local global_ok, global_val = pcall(a.nvim_get_option, k)
+ if global_ok then
+ return global_val
+ end
+
+ error("win_get: This should never happen. File an issue and tag @tjdevries")
end
error("This fallback case should not be possible. " .. k)