diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 1723c30bb..d05723e39 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -306,7 +306,7 @@ function M.get_indent(lnum) end else -- aligned indent - if c_is_last_in_line and c_srow and o_srow ~= c_srow and c_srow < lnum - 1 then + if lnum - 1 <= o_srow or (c_is_last_in_line and c_srow and o_srow ~= c_srow and c_srow < lnum - 1) then -- If current line is outside the range of a node marked with `@aligned_indent` -- Then its indent level shouldn't be affected by `@aligned_indent` node indent = math.max(indent - indent_size, 0)