aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-10-12 15:39:39 +0800
committerGitHub <noreply@github.com>2023-10-12 15:39:39 +0800
commit840e1864c2de2b4b192a4df1865b69093904b139 (patch)
treef5c746500e0b7880e1fcc1288c38c662d130fbcb /test/functional/plugin/lsp_spec.lua
parentd2d38858d1f33a2cd92e9a6182ece2459b0d6f75 (diff)
downloadrneovim-840e1864c2de2b4b192a4df1865b69093904b139.tar.gz
rneovim-840e1864c2de2b4b192a4df1865b69093904b139.tar.bz2
rneovim-840e1864c2de2b4b192a4df1865b69093904b139.zip
fix(lsp): handle NUL bytes in popup text (#25612)
Fix #25610
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r--test/functional/plugin/lsp_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 73e05d8d11..8a4a82fa38 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -3069,6 +3069,18 @@ describe('LSP', function()
it('calculates size correctly with wrapping', function()
eq({15,5}, exec_lua[[ return {vim.lsp.util._make_floating_popup_size(contents,{width = 15, wrap_at = 14})} ]])
end)
+
+ it('handles NUL bytes in text', function()
+ exec_lua([[ contents = {
+ '\000\001\002\003\004\005\006\007\008\009',
+ '\010\011\012\013\014\015\016\017\018\019',
+ '\020\021\022\023\024\025\026\027\028\029',
+ } ]])
+ command('set list listchars=')
+ eq({20,3}, exec_lua[[ return {vim.lsp.util._make_floating_popup_size(contents)} ]])
+ command('set display+=uhex')
+ eq({40,3}, exec_lua[[ return {vim.lsp.util._make_floating_popup_size(contents)} ]])
+ end)
end)
describe('lsp.util.trim.trim_empty_lines', function()