diff options
author | jadedpasta <86900272+jadedpasta@users.noreply.github.com> | 2021-07-04 02:14:39 -0500 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-14 13:15:38 +0100 |
commit | ae89330ec0479cfa9eaaa2b64d8164e3309a1fea (patch) | |
tree | 20ec328d05f7cb11157c6f2aec0ffc80fd0a7e35 | |
parent | 2229e99ef918ad82c4d20d654b0299195f0ed15c (diff) | |
download | rneovim-ae89330ec0479cfa9eaaa2b64d8164e3309a1fea.tar.gz rneovim-ae89330ec0479cfa9eaaa2b64d8164e3309a1fea.tar.bz2 rneovim-ae89330ec0479cfa9eaaa2b64d8164e3309a1fea.zip |
backport: fix(vim.opt): vimL map string values not trimmed (#14982)
Options formatted as a list of comma-separated key-value pairs may have
values that contain leading and trailing whitespace characters. For
example, the `listchars` option has a default value of
`"tab:> ,trail:-,nbsp:+"`. When converting this value to a lua table,
leading and trailing whitespace should not be trimmed.
Co-authored-by: Robert Hrusecky <robert.hrusecky@utexas.edu>
-rw-r--r-- | runtime/lua/vim/_meta.lua | 1 | ||||
-rw-r--r-- | test/functional/lua/vim_spec.lua | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index b1f935541c..f7d47c1030 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -494,7 +494,6 @@ local convert_value_to_lua = (function() for _, key_value_str in ipairs(comma_split) do local key, value = unpack(vim.split(key_value_str, ":")) key = vim.trim(key) - value = vim.trim(value) result[key] = value end diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index eff838aea3..976e63b44d 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -1332,12 +1332,12 @@ describe('lua stdlib', function() it('should work for key-value pair options', function() local listchars = exec_lua [[ - vim.opt.listchars = "tab:>~,space:_" + vim.opt.listchars = "tab:> ,space:_" return vim.opt.listchars:get() ]] eq({ - tab = ">~", + tab = "> ", space = "_", }, listchars) end) |