mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
Fix incremental selection for nodes that include EOL
From `:h setpos()` > If "col" is smaller than 1 then 1 is used. This can be tested with incremental selection on a vim file. ```vim set title ```
This commit is contained in:
parent
48215a63f3
commit
3aa122edfd
1 changed files with 2 additions and 1 deletions
|
|
@ -208,7 +208,8 @@ function M.update_selection(buf, node, selection_mode)
|
||||||
|
|
||||||
-- Convert exclusive end position to inclusive
|
-- Convert exclusive end position to inclusive
|
||||||
if end_col == 1 then
|
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
|
else
|
||||||
vim.fn.setpos(".", { buf, end_row, end_col - 1, 0 })
|
vim.fn.setpos(".", { buf, end_row, end_col - 1, 0 })
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue