From dd600cf1c28aed1d922063c76b081c222d5b7fbc Mon Sep 17 00:00:00 2001 From: haoxian Date: Thu, 2 Feb 2023 12:06:34 +0800 Subject: fix: incremental_selection error if some empty lines in the end of file, would throw error messages when incremental_selection to the whole file. --- lua/nvim-treesitter/ts_utils.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'lua') diff --git a/lua/nvim-treesitter/ts_utils.lua b/lua/nvim-treesitter/ts_utils.lua index e9fdc41d2..775094bd5 100644 --- a/lua/nvim-treesitter/ts_utils.lua +++ b/lua/nvim-treesitter/ts_utils.lua @@ -246,6 +246,7 @@ function M.get_vim_range(range, buf) else ecol = #api.nvim_buf_get_lines(buf, erow - 1, erow, false)[1] end + ecol = math.max(ecol, 1) end return srow, scol, erow, ecol end -- cgit v1.2.3-70-g09d2