branch: elpa/typst-ts-mode
commit 78e6ec9921f4dcc82c15b51e7a5c82b14a1def50
Author: Huan Nguyen <nguyenthieuh...@gmail.com>
Commit: Huan Nguyen <nguyenthieuh...@gmail.com>

    fix: #15 heading inserting should still work
---
 typst-ts-editing.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 1cb3c75884..3af680df9c 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -92,14 +92,15 @@ the `GLOBAL-MAP' (example: `right-word')."
 The new heading is created after the ending of current heading.
 Using ARG argument will ignore the context and it will insert a heading 
instead."
   (interactive "P")
-  (let ((node (treesit-parent-until
-               (treesit-node-at (line-beginning-position))
-               (lambda (node)
-                 (string= "item" (treesit-node-type node))))))
+  (let ((item-node (treesit-parent-until
+                    (treesit-node-at (line-beginning-position))
+                    (lambda (node)
+                      (string= "item" (treesit-node-type node)))))
+        (node (typst-ts-core-get-parent-of-node-at-bol-nonwhite)))
     (cond
      (arg (typst-ts-mode-insert--heading nil))
-     (node
-      (typst-ts-mode-insert--item node))
+     (item-node
+      (typst-ts-mode-insert--item item-node))
      (t
       (typst-ts-mode-insert--heading node)))))
 

Reply via email to