Skip to content

Commit 46fdb65

Browse files
committed
feat: Add hook after indicator refresh
1 parent 9cbc292 commit 46fdb65

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ turn off `treesit-fold-mode`
475475
with this plugin.
476476
477477
```elisp
478-
479478
(setq treesit-fold-indicators-face-function
480479
(lambda (pos &rest _)
481480
;; Return the face of it's function.
@@ -489,6 +488,11 @@ turn off `treesit-fold-mode`
489488
(advice-add 'line-reminder-transfer-to-saved-lines :after
490489
;; Refresh indicators for package `treesit-fold'.
491490
#'treesit-fold-indicators-refresh)
491+
492+
(add-hook 'treesit-fold-indicators-refresh-hook
493+
(lambda (&rest _)
494+
(line-reminder--render-buffer)
495+
(line-reminder--thumb-render-buffer)))
492496
```
493497
494498
### 📝 Summary

treesit-fold-indicators.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
(const :tag "Inaccurate rendering but fast" partial))
5959
:group 'treesit-fold)
6060

61+
(defcustom treesit-fold-indicators-refresh-hook nil
62+
"Hook run after indicators refresh."
63+
:type 'hook
64+
:group 'treesit-fold)
65+
6166
(fringe-helper-define 'treesit-fold-indicators-fr-plus nil
6267
"XXXXXXX"
6368
"X.....X"
@@ -362,7 +367,8 @@ Optional arguments WEND and WSTART are the range for caching."
362367
(treesit-fold-indicators--remove-ovs)
363368
(thread-last nodes-to-fold
364369
(mapcar #'cdr)
365-
(mapc #'treesit-fold-indicators--create))))))
370+
(mapc #'treesit-fold-indicators--create))
371+
(run-hooks 'treesit-fold-indicators-refresh-hook)))))
366372

367373
(defun treesit-fold-indicators--remove-ovs (&optional window)
368374
"Remove all indicators overlays in this WINDOW."

0 commit comments

Comments
 (0)