From 72a4a07126a27c7cc7dcf1ca0ad2aa0262602e94 Mon Sep 17 00:00:00 2001 From: kiyan42 Date: Sun, 2 Aug 2020 16:44:46 +0200 Subject: [PATCH] fix decremental selection --- lua/nvim-treesitter/incremental_selection.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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