branch: externals/org-transclusion
commit 5dcb745d85ea8248eac34c538661ea5ab6f1caab
Author: gggion <[email protected]>
Commit: gggion <[email protected]>

    refactor: different idle timers for terminal vs graphical
    
    * org-transclusion-indent-mode.el
    (org-transclusion-indent--schedule-reapply): Use 0.2 second delay in
    graphical mode and 0.7 second delay in terminal mode. Graphical mode can
    use a shorter delay since bitmap fringe rendering is fast and
    flicker-free. Terminal mode needs a longer delay to reduce visible
    flicker of ASCII fringe indicators during rapid typing. The longer delay
    allows typing to settle before redrawing fringes in terminal
    environments where the "| " pseudo-fringe is rendered as visible text.
---
 org-transclusion-indent-mode.el | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/org-transclusion-indent-mode.el b/org-transclusion-indent-mode.el
index 3dc68766a6..96393d222f 100644
--- a/org-transclusion-indent-mode.el
+++ b/org-transclusion-indent-mode.el
@@ -109,16 +109,22 @@ org-indent may regenerate individual lines during typing."
 
 (defun org-transclusion-indent--schedule-reapply ()
   "Schedule fringe re-application after a short delay.
-This debounces rapid changes to avoid excessive processing."
+This debounces rapid changes to avoid excessive processing.
+
+In graphical mode, uses a shorter delay (0.2s) since bitmap rendering
+is fast and flicker-free.  In terminal mode, uses a longer delay (0.7s)
+to reduce visible flicker of ASCII fringe indicators during rapid typing."
   (when org-transclusion-indent--timer
     (cancel-timer org-transclusion-indent--timer))
   (setq org-transclusion-indent--timer
-        (run-with-idle-timer 0.1 nil
-                             (lambda (buf)
-                               (when (buffer-live-p buf)
-                                 (with-current-buffer buf
-                                   
(org-transclusion-indent--reapply-all-fringes))))
-                             (current-buffer))))
+        (run-with-idle-timer
+         (if (display-graphic-p) 0.2 0.7)  ; Shorter delay for graphical, 
longer for terminal
+         nil
+         (lambda (buf)
+           (when (buffer-live-p buf)
+             (with-current-buffer buf
+               (org-transclusion-indent--reapply-all-fringes))))
+         (current-buffer))))
 
 (defun org-transclusion-indent--after-change (_beg _end _len)
   "Schedule fringe re-application after buffer change.

Reply via email to