diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2024-06-12 19:31:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 19:31:15 -0500 |
commit | 6311a7fe4b416c23a336c1392a44cf3192ebde36 (patch) | |
tree | bcfb2a4d0f88ec56379f656831c8195ea3278d47 /runtime/lua/vim/text.lua | |
parent | 53afdf360cf195c02c22865f4e63b273d1ef152e (diff) | |
parent | 5493fcd52f2eaab4b6a81c366529e80ca3dec535 (diff) | |
download | rneovim-6311a7fe4b416c23a336c1392a44cf3192ebde36.tar.gz rneovim-6311a7fe4b416c23a336c1392a44cf3192ebde36.tar.bz2 rneovim-6311a7fe4b416c23a336c1392a44cf3192ebde36.zip |
Merge pull request #29103 from gpanders/test-no-tgc
test: do not set termguicolors in test runner
Diffstat (limited to 'runtime/lua/vim/text.lua')
-rw-r--r-- | runtime/lua/vim/text.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/lua/vim/text.lua b/runtime/lua/vim/text.lua index bc90d490aa..0be3396464 100644 --- a/runtime/lua/vim/text.lua +++ b/runtime/lua/vim/text.lua @@ -18,15 +18,19 @@ end --- Hex decode a string. --- --- @param enc string String to decode ---- @return string : Decoded string +--- @return string? : Decoded string +--- @return string? : Error message, if any function M.hexdecode(enc) - assert(#enc % 2 == 0, 'string must have an even number of hex characters') + if #enc % 2 ~= 0 then + return nil, 'string must have an even number of hex characters' + end + local str = {} ---@type string[] for i = 1, #enc, 2 do local n = assert(tonumber(enc:sub(i, i + 1), 16)) str[#str + 1] = string.char(n) end - return table.concat(str) + return table.concat(str), nil end return M |