1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-26 00:01:47 -07:00

Fix treesit-show-paren-data to match only 2 children nodes or more

* lisp/treesit.el (treesit-show-paren-data--categorize):
Ignore parent that has less than two children (bug#80475).
This ensures the distinct first and last node.
This commit is contained in:
Juri Linkov 2026-02-23 20:34:15 +02:00
parent e4b3fa4a00
commit ff4773ed02

View file

@ -4370,6 +4370,8 @@ as belonging to the node that ends before POS (by subtracting 1 from POS)."
pred (treesit-language-at (if end-p (1- pos) pos)))
(treesit-parent-until
(treesit-node-at (if end-p (1- pos) pos)) pred)))
(parent (when (and parent (> (treesit-node-child-count parent) 1))
parent))
(first (when parent (treesit-node-child parent 0)))
(first-start (when first (treesit-node-start first)))
(first-end (when first (treesit-node-end first)))