diff options
author | TJ DeVries <devries.timothyj@gmail.com> | 2021-06-11 13:39:59 -0400 |
---|---|---|
committer | TJ DeVries <devries.timothyj@gmail.com> | 2021-06-29 08:42:07 -0400 |
commit | 6ecec87c099ce6182b4a1cc81846be9e0e70c1cd (patch) | |
tree | e8f74f11e8d650030550bae587fe2c0b68352096 /runtime/lua/vim/_meta.lua | |
parent | 9119ea1becd5024ad14db04e2868feeae7c7d4de (diff) | |
download | rneovim-6ecec87c099ce6182b4a1cc81846be9e0e70c1cd.tar.gz rneovim-6ecec87c099ce6182b4a1cc81846be9e0e70c1cd.tar.bz2 rneovim-6ecec87c099ce6182b4a1cc81846be9e0e70c1cd.zip |
fix(vim.opt): Fix #14668 Now correctly handles unescaped commas in isfname style
Diffstat (limited to 'runtime/lua/vim/_meta.lua')
-rw-r--r-- | runtime/lua/vim/_meta.lua | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index e030c9ac81..416746b2cc 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -405,12 +405,46 @@ local convert_value_to_lua = (function() [OptionTypes.NUMBER] = function(_, value) return value end, [OptionTypes.STRING] = function(_, value) return value end, - [OptionTypes.ARRAY] = function(_, value) + [OptionTypes.ARRAY] = function(info, value) if type(value) == "table" then - value = remove_duplicate_values(value) + if not info.allows_duplicates then + value = remove_duplicate_values(value) + end + return value end + -- Handles unescaped commas in a list. + if string.find(value, ",,,") then + local comma_split = vim.split(value, ",,,") + local left = comma_split[1] + local right = comma_split[2] + + local result = {} + vim.list_extend(result, vim.split(left, ",")) + table.insert(result, ",") + vim.list_extend(result, vim.split(right, ",")) + + table.sort(result) + + return result + end + + if string.find(value, ",^,,", 1, true) then + local comma_split = vim.split(value, ",^,,", true) + local left = comma_split[1] + local right = comma_split[2] + + local result = {} + vim.list_extend(result, vim.split(left, ",")) + table.insert(result, "^,") + vim.list_extend(result, vim.split(right, ",")) + + table.sort(result) + + return result + end + return vim.split(value, ",") end, |