aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/lua.txt5
-rw-r--r--runtime/lua/vim/text.lua10
-rw-r--r--test/functional/core/startup_spec.lua6
-rw-r--r--test/functional/testnvim.lua2
-rw-r--r--test/functional/ui/popupmenu_spec.lua2
5 files changed, 12 insertions, 13 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index fe2abfe956..3bfd1d1885 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -4388,8 +4388,9 @@ vim.text.hexdecode({enc}) *vim.text.hexdecode()*
Parameters: ~
• {enc} (`string`) String to decode
- Return: ~
- (`string`) Decoded string
+ Return (multiple): ~
+ (`string?`) Decoded string
+ (`string?`) Error message, if any
vim.text.hexencode({str}) *vim.text.hexencode()*
Hex encode a string.
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
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index a53625ab1b..1bb4ce2946 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -400,9 +400,6 @@ describe('startup', function()
read_file('Xtest_startup_ttyout')
)
end)
- if is_os('win') then
- assert_log('stream write failed. RPC canceled; closing channel', testlog)
- end
end)
it('input from pipe: has("ttyin")==0 has("ttyout")==1', function()
@@ -435,9 +432,6 @@ describe('startup', function()
read_file('Xtest_startup_ttyout')
)
end)
- if is_os('win') then
- assert_log('stream write failed. RPC canceled; closing channel', testlog)
- end
end)
it('input from pipe (implicit) #7679', function()
diff --git a/test/functional/testnvim.lua b/test/functional/testnvim.lua
index 746c7290ef..5a9e7f8c29 100644
--- a/test/functional/testnvim.lua
+++ b/test/functional/testnvim.lua
@@ -22,7 +22,7 @@ local runtime_set = 'set runtimepath^=./build/lib/nvim/'
M.nvim_prog = (os.getenv('NVIM_PRG') or t.paths.test_build_dir .. '/bin/nvim')
-- Default settings for the test session.
M.nvim_set = (
- 'set shortmess+=IS background=light termguicolors noswapfile noautoindent startofline'
+ 'set shortmess+=IS background=light noswapfile noautoindent startofline'
.. ' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
.. ' belloff= wildoptions-=pum joinspaces noshowcmd noruler nomore redrawdebug=invalid'
)
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 8f8604eecb..cc21a797e3 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -1129,7 +1129,7 @@ describe("builtin popupmenu 'pumblend'", function()
[10] = { foreground = tonumber('0x000002') },
})
screen:attach({ rgb = false })
- command('set notermguicolors pumblend=10')
+ command('set pumblend=10')
insert([[
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor