branch: elpa/treesit-fold
commit 21bba126bed782a33327f4cdf230d7c91db060d6
Author: JenChieh <[email protected]>
Commit: JenChieh <[email protected]>
fix: Ensure refresh when window size changes
---
ts-fold-indicators.el | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ts-fold-indicators.el b/ts-fold-indicators.el
index 7eaf317d0c..619a5cd69b 100644
--- a/ts-fold-indicators.el
+++ b/ts-fold-indicators.el
@@ -110,6 +110,7 @@
(progn
(add-hook 'tree-sitter-after-change-functions
#'ts-fold-indicators-refresh nil t)
(add-hook 'after-save-hook #'ts-fold-indicators-refresh nil t)
+ (add-hook 'window-size-change-functions
#'ts-fold-indicators--size-change)
(add-hook 'window-scroll-functions #'ts-fold-indicators--scroll)
(ts-fold-indicators--render-buffer))
(ts-fold-indicators-mode -1)))
@@ -118,6 +119,7 @@
"Disable `ts-fold-indicators' mode."
(remove-hook 'tree-sitter-after-change-functions
#'ts-fold-indicators-refresh t)
(remove-hook 'after-save-hook #'ts-fold-indicators-refresh t)
+ (remove-hook 'window-size-change-functions #'ts-fold-indicators--size-change)
(remove-hook 'window-scroll-functions #'ts-fold-indicators--scroll)
(ts-fold-indicators--remove-ovs-buffer))
@@ -280,6 +282,11 @@ Argument FOLDED holds folding state; it's a boolean."
(let ((folded (ts-fold-overlay-at node)))
(ts-fold-indicators--create-overlays beg end folded))))
+(defun ts-fold-indicators--size-change (&optional frame &rest _)
+ "Render indicators for all visible windows."
+ (ts-fold--with-no-redisplay
+ (dolist (win (window-list frame)) (ts-fold-indicators--render-window
win))))
+
(defun ts-fold-indicators--scroll (&optional window &rest _)
"Render indicators on WINDOW."
(ts-fold--with-no-redisplay