aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/ts_utils.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/ts_utils.lua b/lua/nvim-treesitter/ts_utils.lua
index 72a74edcc..11fb17d78 100644
--- a/lua/nvim-treesitter/ts_utils.lua
+++ b/lua/nvim-treesitter/ts_utils.lua
@@ -208,7 +208,8 @@ function M.update_selection(buf, node, selection_mode)
-- Convert exclusive end position to inclusive
if end_col == 1 then
- vim.fn.setpos(".", { buf, end_row - 1, -1, 0 })
+ local previous_col = vim.fn.col { end_row - 1, "$" } - 1
+ vim.fn.setpos(".", { buf, end_row - 1, previous_col, 0 })
else
vim.fn.setpos(".", { buf, end_row, end_col - 1, 0 })
end