mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 03:45:42 +00:00
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:
@@ -33,7 +33,7 @@ end
|
|||||||
function M.getlines(bufnr, start_lnum, end_lnum)
|
function M.getlines(bufnr, start_lnum, end_lnum)
|
||||||
if not end_lnum then
|
if not end_lnum then
|
||||||
-- Return a single line as a string
|
-- 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
|
end
|
||||||
return api.nvim_buf_get_lines(bufnr, start_lnum - 1, end_lnum, false)
|
return api.nvim_buf_get_lines(bufnr, start_lnum - 1, end_lnum, false)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user