fix(filetype.lua): always return a string in getlines function (#19080)

This re-introduces the fix that the filetype.lua refactor inadvertently reverted.
The fix ensures that in the case when end_lnum is omitted, a string is always returned.
This commit is contained in:
Hazel Weakly
2022-06-24 10:53:44 -07:00
committed by GitHub
parent 12c62ddea6
commit 35e89bf903

View File

@@ -33,7 +33,7 @@ end
function M.getlines(bufnr, start_lnum, end_lnum)
if not end_lnum then
-- Return a single line as a string
return api.nvim_buf_get_lines(bufnr, start_lnum - 1, start_lnum, false)[1]
return api.nvim_buf_get_lines(bufnr, start_lnum - 1, start_lnum, false)[1] or ''
end
return api.nvim_buf_get_lines(bufnr, start_lnum - 1, end_lnum, false)
end