aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotomo <notomo.motono@gmail.com>2020-06-03 08:31:43 +0900
committerGitHub <noreply@github.com>2020-06-02 19:31:43 -0400
commit60c581b35db439dd6b32cdc2ebe1a5aed933b44c (patch)
tree5020bb54b410507c16863c01d546eae8bf508731
parent91e41c857622b61adcf84f6a6af87a3f5a4d65f5 (diff)
downloadrneovim-60c581b35db439dd6b32cdc2ebe1a5aed933b44c.tar.gz
rneovim-60c581b35db439dd6b32cdc2ebe1a5aed933b44c.tar.bz2
rneovim-60c581b35db439dd6b32cdc2ebe1a5aed933b44c.zip
lua: fix infinite loop for vim.split on empty string (#12420)
-rw-r--r--runtime/lua/vim/shared.lua2
-rw-r--r--test/functional/lua/vim_spec.lua1
2 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index 2135bfc837..5dc8d6dc10 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -79,7 +79,7 @@ function vim.gsplit(s, sep, plain)
end
return function()
- if done then
+ if done or s == '' then
return
end
if sep == '' then
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 596b960419..61bc3e1e3c 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -243,6 +243,7 @@ describe('lua stdlib', function()
{ "here be dragons", " ", false, { "here", "be", "dragons"} },
{ "axaby", "ab?", false, { '', 'x', 'y' } },
{ "f v2v v3v w2w ", "([vw])2%1", false, { 'f ', ' v3v ', ' ' } },
+ { "", "", false, {} },
{ "x*yz*oo*l", "*", true, { 'x', 'yz', 'oo', 'l' } },
}