indent: fix wrong line number passed to descendant_for_range

This commit is contained in:
Jędrzej Boczar 2021-01-07 22:29:57 +01:00 committed by Thomas Vigouroux
parent 4538a876b4
commit 42bc217a54

View file

@ -60,7 +60,7 @@ function M.get_indent(lnum)
-- and if the node is an indent node, we should set the indent level as the indent_size
-- and we set the node as the first child of this wrapper node or the wrapper itself
if not node then
local wrapper = root:descendant_for_range(lnum, 0, lnum, -1)
local wrapper = root:descendant_for_range(lnum-1, 0, lnum-1, -1)
node = wrapper:child(0) or wrapper
if indents[node_fmt(wrapper)] ~= nil and wrapper ~= root then
indent = indent_size