fix decremental selection

This commit is contained in:
kiyan42 2020-08-02 16:44:46 +02:00 committed by Thomas Vigouroux
parent 5c5f4c5d54
commit a855538e0a

View file

@ -55,13 +55,18 @@ local function select_incremental(get_parent)
local root = parsers.get_parser().tree:root() local root = parsers.get_parser().tree:root()
local node = root:named_descendant_for_range(csrow, cscol, cerow, cecol) local node = root:named_descendant_for_range(csrow, cscol, cerow, cecol)
ts_utils.update_selection(buf, node) 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 return
end end
local node = get_parent(nodes[#nodes]) local node = get_parent(nodes[#nodes])
if not node then return end if not node then return end
table.insert(selections[buf], node)
if node ~= nodes[#nodes] then if node ~= nodes[#nodes] then
table.insert(nodes, node) table.insert(nodes, node)
end end