branch: elpa/typst-ts-mode commit 741769a3ac9c411d39cefe49fd6f4d995bd7d89f Author: Huan Nguyen <nguyenthieuh...@gmail.com> Commit: Huan Nguyen <nguyenthieuh...@gmail.com>
fix: `delete-region` so that the line is not removed --- typst-ts-editing.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/typst-ts-editing.el b/typst-ts-editing.el index 9bef1f2044..8f15490ffd 100644 --- a/typst-ts-editing.el +++ b/typst-ts-editing.el @@ -149,8 +149,7 @@ When prefix ARG is non-nil, call global return function." (call-interactively #'newline) (typst-ts-mode-insert--item item-node)) ;; no text means delete the item on current line: (item -) - (beginning-of-line) - (delete-line) + (delete-region (line-beginning-position) (line-end-position)) ;; whether the previous line is in an item (let* ((prev-line-item-node (typst-ts-core-parent-util-type @@ -163,7 +162,7 @@ When prefix ARG is non-nil, call global return function." (progn ;; sometimes there is no newlines characters at the EOL (ignore-errors - (delete-line)) + (delete-region (line-beginning-position) (line-end-position))) (forward-line -1) (end-of-line) (call-interactively #'newline)) @@ -277,7 +276,7 @@ When there is no section it will insert a heading below point." (prev-significant-node-type (treesit-node-type prev-significant-node)) prev-item-node) - + (if (equal prev-significant-node-type "item") (setq prev-item-node prev-significant-node) (if (equal @@ -286,9 +285,9 @@ When there is no section it will insert a heading below point." (treesit-node-parent prev-significant-node))) (setq prev-item-node (treesit-node-parent prev-significant-node)))) - + ;; (message "%s, %s" cur-item-node prev-item-node) - + (unless prev-item-node (throw 'execute-result 'default)) @@ -310,7 +309,7 @@ When there is no section it will insert a heading below point." (- typst-ts-mode-indent-offset (abs offset))))) (throw 'execute-result 'success))) - + (t nil))))) ;; execute default action if not successful (unless (eq execute-result 'success)