diff options
| author | Axel Dahlberg <git@valleymnt.com> | 2022-07-29 17:35:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-29 17:35:29 +0200 |
| commit | 0d7fab0c3323ed2e50ccdf14fd24fbbad664f7b1 (patch) | |
| tree | 4adfffa3b333ecb151c4b5e2949c137c09c3997a /lua/nvim-treesitter | |
| parent | 5c4548c070b021df8c412398548e6a2ce528233c (diff) | |
feat(ts_utils): allow starting selection after last character (#3233)
Diffstat (limited to 'lua/nvim-treesitter')
| -rw-r--r-- | lua/nvim-treesitter/ts_utils.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lua/nvim-treesitter/ts_utils.lua b/lua/nvim-treesitter/ts_utils.lua index 8200e78e..f5ad3354 100644 --- a/lua/nvim-treesitter/ts_utils.lua +++ b/lua/nvim-treesitter/ts_utils.lua @@ -259,14 +259,14 @@ function M.update_selection(buf, node, selection_mode) selection_mode = selection_mode or "charwise" local start_row, start_col, end_row, end_col = M.get_vim_range({ M.get_node_range(node) }, buf) - vim.fn.setpos(".", { buf, start_row, start_col, 0 }) - -- Start visual selection in appropriate mode local v_table = { charwise = "v", linewise = "V", blockwise = "<C-v>" } ---- Call to `nvim_replace_termcodes()` is needed for sending appropriate ---- command to enter blockwise mode local mode_string = vim.api.nvim_replace_termcodes(v_table[selection_mode] or selection_mode, true, true, true) vim.cmd("normal! " .. mode_string) + vim.fn.setpos(".", { buf, start_row, start_col, 0 }) + vim.cmd "normal! o" vim.fn.setpos(".", { buf, end_row, end_col, 0 }) end |
