diff options
| author | altermo <107814000+altermo@users.noreply.github.com> | 2026-08-01 18:04:09 +0200 |
|---|---|---|
| committer | altermo <107814000+altermo@users.noreply.github.com> | 2026-08-01 18:20:13 +0200 |
| commit | 77dfa02f3ec74555039a20b9c68ea9e27eebf03c (patch) | |
| tree | d9d4560d9c37c936817112937134bb33c996b7c6 /runtime/lua/vim/treesitter/_select.lua | |
| parent | fe8e6a7efa33dc9ea1c57aa3f65be9469f05f287 (diff) | |
| download | rneovim-77dfa02f3ec74555039a20b9c68ea9e27eebf03c.tar.gz rneovim-77dfa02f3ec74555039a20b9c68ea9e27eebf03c.tar.bz2 rneovim-77dfa02f3ec74555039a20b9c68ea9e27eebf03c.zip | |
refactor: combine all visual_selection funcions
Diffstat (limited to 'runtime/lua/vim/treesitter/_select.lua')
| -rw-r--r-- | runtime/lua/vim/treesitter/_select.lua | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/runtime/lua/vim/treesitter/_select.lua b/runtime/lua/vim/treesitter/_select.lua index 2fb5fc1561..0765ae3b16 100644 --- a/runtime/lua/vim/treesitter/_select.lua +++ b/runtime/lua/vim/treesitter/_select.lua @@ -348,36 +348,6 @@ local function node_normalize_down(node) return node end -local function visual_select(range) - assert(type(range) == 'table') - local srow, scol, erow, ecol = Range.unpack4(range) - local cursor_other_end_of_visual = false - - local vcol, vrow = vim.fn.col('v'), vim.fn.line('v') - local ccol, cline = vim.fn.col('.'), vim.fn.line('.') - if vrow > cline or (vrow == cline and vcol > ccol) then - cursor_other_end_of_visual = true - end - - if ecol == 0 then - erow = erow - 1 - ecol = #vim.fn.getline(erow + 1) + 1 - end - - if vim.fn.visualmode() ~= 'v' then - -- reset visualmode() to 'v' - vim.cmd.normal({ 'v\27', bang = true }) - end - - vim.fn.setpos("'<", { 0, srow + 1, scol + 1, 0 }) - vim.fn.setpos("'>", { 0, erow + 1, ecol, 0 }) - if cursor_other_end_of_visual then - vim.cmd.normal({ 'gvo', bang = true }) - else - vim.cmd.normal({ 'gv', bang = true }) - end -end - --- @return Range4 local function get_selection() local pos1 = vim.fn.getpos('v') @@ -596,7 +566,7 @@ local function repeate_apply_range(count, fn) end if range and count ~= 0 then - visual_select(range) + Range.visual_select(range) end end |