branch: elpa/typst-ts-mode
commit 6a1ff662e1eaa10b120c1c6d96ac8f0f6671fcf9
Author: meowking <[email protected]>
Commit: meowking <[email protected]>
fix(editing): typst-ts-mode-return on item newline issue
---
typst-ts-editing.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index c1fad3c3be..39b4344962 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -133,8 +133,13 @@ When prefix ARG is non-nil, call global return function."
(if child-node
(if (and (equal next-line-node-type "item")
;; end of buffer situation (or next line is the end
- ;; line (no newline character))
- (not (equal next-line-node item-node)))
+ ;; line (and no newline character))
+ (not (equal
+ (line-number-at-pos
+ (save-excursion
+ (forward-line 1)
+ (point)))
+ (line-number-at-pos (point-max)))))
(call-interactively #'newline)
(typst-ts-mode-insert--item item-node))
;; no text means delete the item on current line: (item -)