diff options
| author | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-08-02 16:44:46 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-08-02 20:14:34 +0200 |
| commit | a855538e0aad238b6f8df6750b81f0ef4880092f (patch) | |
| tree | 50d6764d205a2a36e7e123e303d323f828993ba8 /lua | |
| parent | RST: update locals (diff) | |
| download | nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.tar nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.tar.gz nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.tar.bz2 nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.tar.lz nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.tar.xz nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.tar.zst nvim-treesitter-a855538e0aad238b6f8df6750b81f0ef4880092f.zip | |
fix decremental selection
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/incremental_selection.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/incremental_selection.lua b/lua/nvim-treesitter/incremental_selection.lua index 045e7db23..3e1b51b9b 100644 --- a/lua/nvim-treesitter/incremental_selection.lua +++ b/lua/nvim-treesitter/incremental_selection.lua @@ -55,13 +55,18 @@ local function select_incremental(get_parent) local root = parsers.get_parser().tree:root() local node = root:named_descendant_for_range(csrow, cscol, cerow, cecol) ts_utils.update_selection(buf, node) - selections[buf] = { [1] = node } + if nodes and #nodes > 0 then + table.insert(selections[buf], node) + else + selections[buf] = { [1] = node } + end return end local node = get_parent(nodes[#nodes]) if not node then return end + table.insert(selections[buf], node) if node ~= nodes[#nodes] then table.insert(nodes, node) end |
