branch: elpa/treesit-fold
commit d563c38a61b5379b8d728b0d23d90bab2f0930fe
Author: Jen-Chieh Shen <[email protected]>
Commit: Jen-Chieh Shen <[email protected]>
Fix return toggle
---
tree-sitter-fold-indicators.el | 9 ++++++---
tree-sitter-fold.el | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tree-sitter-fold-indicators.el b/tree-sitter-fold-indicators.el
index 1a80431c83..4468ba2d2b 100644
--- a/tree-sitter-fold-indicators.el
+++ b/tree-sitter-fold-indicators.el
@@ -26,6 +26,7 @@
;;; Code:
(require 'cl-lib)
+(require 'seq)
(require 'subr-x)
(require 'fringe-helper)
@@ -150,9 +151,11 @@
(lambda (ov) (= cur-ln (line-number-at-pos (overlay-start
ov))))
ovs))
(when ov
- (end-of-line)
- (when (nth 4 (syntax-ppss)) (back-to-indentation))
- (call-interactively #'tree-sitter-fold-toggle))))))
+ (or (save-excursion
+ (end-of-line)
+ (when (nth 4 (syntax-ppss)) (back-to-indentation))
+ (tree-sitter-fold-toggle))
+ (tree-sitter-fold-toggle)))))))
;;
;; (@* "Core" )
diff --git a/tree-sitter-fold.el b/tree-sitter-fold.el
index 9148cc1a24..fc2b6253a6 100644
--- a/tree-sitter-fold.el
+++ b/tree-sitter-fold.el
@@ -314,7 +314,7 @@ If the current syntax node is not foldable, do nothing."
(tree-sitter-fold--ensure-ts
(if-let* ((node (tree-sitter-fold--foldable-node-at-pos (point)))
(ov (tree-sitter-fold-overlay-at node)))
- (delete-overlay ov)
+ (progn (delete-overlay ov) t)
(tree-sitter-fold-close))))
(defun tree-sitter-fold--after-command (&rest _)