Skip to content

Commit

Permalink
perf
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jul 15, 2024
1 parent 7e23a8d commit 0859884
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ts-fold-indicators.el
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
(progn
(add-hook 'tree-sitter-after-change-functions #'ts-fold-indicators--trigger-render nil t)
(add-hook 'after-save-hook #'ts-fold-indicators--trigger-render nil t)
(add-hook 'pre-command-hook #'ts-fold-indicators--pre-command nil t)
(add-hook 'post-command-hook #'ts-fold-indicators--post-command nil t)
(add-hook 'window-size-change-functions #'ts-fold-indicators--size-change)
(add-hook 'window-scroll-functions #'ts-fold-indicators--scroll)
Expand All @@ -133,6 +134,7 @@
"Disable `ts-fold-indicators' mode."
(remove-hook 'tree-sitter-after-change-functions #'ts-fold-indicators--trigger-render t)
(remove-hook 'after-save-hook #'ts-fold-indicators--trigger-render t)
(remove-hook 'pre-command-hook #'ts-fold-indicators--pre-command t)
(remove-hook 'post-command-hook #'ts-fold-indicators--post-command t)
(remove-hook 'window-size-change-functions #'ts-fold-indicators--size-change)
(remove-hook 'window-scroll-functions #'ts-fold-indicators--scroll)
Expand Down Expand Up @@ -327,10 +329,13 @@ Argument FOLDED holds folding state; it's a boolean."
"Trigger rendering on the next redisplay."
(setq ts-fold-indicators--render-this-command-p t)) ; Trigger render at the end.

(defun ts-fold-indicators--pre-command ()
"Pre command."
(set-window-parameter nil 'window-end nil))

(defun ts-fold-indicators--post-command ()
"Post command."
(when ts-fold-indicators--render-this-command-p
(set-window-parameter nil 'window-end nil)
(ts-fold-indicators-refresh)
(setq ts-fold-indicators--render-this-command-p nil)))

Expand Down

0 comments on commit 0859884

Please sign in to comment.