mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
fix(lua): vim.split may trim inner empty items
Problem:
`vim.split('a:::', ':', {trimempty=true})` trims inner empty items.
Regression from 9c49c10470
Solution:
Set `empty_start=false` when first non-empty item is found.
close #23212
This commit is contained in:
@@ -138,7 +138,9 @@ function vim.gsplit(s, sep, opts)
|
||||
local seg = _pass(s:find(sep, start, plain))
|
||||
|
||||
-- Trim empty segments from start/end.
|
||||
if trimempty and seg == '' then
|
||||
if seg ~= '' then
|
||||
empty_start = false
|
||||
elseif trimempty then
|
||||
while not done and seg == '' do
|
||||
empty_segs = empty_segs + 1
|
||||
seg = _pass(s:find(sep, start, plain))
|
||||
|
Reference in New Issue
Block a user