aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorHazel Weakly <hazel@theweaklys.com>2022-06-24 10:53:44 -0700
committerGitHub <noreply@github.com>2022-06-24 19:53:44 +0200
commit35e89bf9036b755ae14ee87712faf005886f04f0 (patch)
treee65af46d19d7a5339be0172269c5061b49755f90 /runtime/lua/vim
parent12c62ddea64159f812682d6cccdb3bf0ff50d035 (diff)
downloadrneovim-35e89bf9036b755ae14ee87712faf005886f04f0.tar.gz
rneovim-35e89bf9036b755ae14ee87712faf005886f04f0.tar.bz2
rneovim-35e89bf9036b755ae14ee87712faf005886f04f0.zip
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 (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 320d6a2a5b..6c4894208f 100644
--- 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