Extend list_extend to take start/finish.

This commit is contained in:
Ashkan Kiani
2019-11-20 17:09:21 -08:00
parent 9b7f956715
commit b984f613c1
4 changed files with 31 additions and 27 deletions

View File

@@ -546,7 +546,6 @@ end
-- Remove empty lines from the beginning and end.
function M.trim_empty_lines(lines)
local result = {}
local start = 1
for i = 1, #lines do
if #lines[i] > 0 then
@@ -561,11 +560,7 @@ function M.trim_empty_lines(lines)
break
end
end
-- TODO(ashkan) use tbl_slice.
for i = start, finish do
table.insert(result, lines[i])
end
return result
return vim.list_extend({}, lines, start, finish)
end
-- Accepts markdown lines and tries to reduce it to a filetype if it is