indents: allow aligned_indent for unfinished calls in C and Python

This commit is contained in:
Stephan Seitz 2022-01-22 14:50:51 +01:00
parent 62982378b8
commit 059fbc487c
7 changed files with 26 additions and 3 deletions

View file

@ -122,7 +122,8 @@ function M.get_indent(lnum)
is_processed = true
end
if q.aligned_indent[node:id()] and srow ~= erow then
-- do not indent for nodes that starts-and-ends on same line and starts on target line (lnum)
if q.aligned_indent[node:id()] and srow ~= erow and (srow ~= lnum - 1) then
local metadata = q.aligned_indent[node:id()]
local opening_delimiter = metadata.delimiter:sub(1, 1)
local o_delim_node, pos = get_matching_prev_sibling(node, { srow, #vim.fn.getline(srow + 1) - 1 }, function(n)