mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
lua: fix behavior when split empty string (#12429)
* lua: fix behavior when split empty string * test: lsp.util.apply_text_edits with an empty edit
This commit is contained in:
@@ -79,7 +79,7 @@ function vim.gsplit(s, sep, plain)
|
||||
end
|
||||
|
||||
return function()
|
||||
if done or s == '' then
|
||||
if done or (s == '' and sep == '') then
|
||||
return
|
||||
end
|
||||
if sep == '' then
|
||||
|
@@ -244,6 +244,7 @@ describe('lua stdlib', function()
|
||||
{ "axaby", "ab?", false, { '', 'x', 'y' } },
|
||||
{ "f v2v v3v w2w ", "([vw])2%1", false, { 'f ', ' v3v ', ' ' } },
|
||||
{ "", "", false, {} },
|
||||
{ "", "a", false, { '' } },
|
||||
{ "x*yz*oo*l", "*", true, { 'x', 'yz', 'oo', 'l' } },
|
||||
}
|
||||
|
||||
|
@@ -800,13 +800,14 @@ describe('LSP', function()
|
||||
make_edit(0, 0, 0, 0, {"123"});
|
||||
make_edit(1, 0, 1, 1, {"2"});
|
||||
make_edit(2, 0, 2, 2, {"3"});
|
||||
make_edit(3, 2, 3, 4, {""});
|
||||
}
|
||||
exec_lua('vim.lsp.util.apply_text_edits(...)', edits, 1)
|
||||
eq({
|
||||
'123First line of text';
|
||||
'2econd line of text';
|
||||
'3ird line of text';
|
||||
'Fourth line of text';
|
||||
'Foth line of text';
|
||||
'å å ɧ 汉语 ↥ 🤦 🦄';
|
||||
}, buf_lines(1))
|
||||
end)
|
||||
|
Reference in New Issue
Block a user