commit 35e89bf9036b755ae14ee87712faf005886f04f0
parent 12c62ddea64159f812682d6cccdb3bf0ff50d035
Author: Hazel Weakly <hazel@theweaklys.com>
Date: Fri, 24 Jun 2022 10:53:44 -0700
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
@@ -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