Fix c-ts-common baseline indentation rule (bug#81735)

* lisp/treesit.el (treesit--indent-prev-line-node): Now skip
over empty lines to find the previous sibling.
This commit is contained in:
Yuan Fu 2026-09-07 16:46:02 -07:00 committed by Eli Zaretskii
parent 84e2bb9a5d
commit d46cc7dda1

View file

@ -2403,10 +2403,13 @@ This variable should take the same form as
over `treesit-simple-indent-rules'.")
(defun treesit--indent-prev-line-node (pos)
"Return the largest node on the previous line of POS."
"Return the largest node on the previous (non-empty) line of POS."
(save-excursion
(goto-char pos)
(when (eq (forward-line -1) 0)
;; Skip blank lines.
(while (and (looking-at-p (rx (* (syntax whitespace)) eol))
(eq (forward-line -1) 0)))
(back-to-indentation)
(treesit--indent-largest-node-at (point)))))