From 5444322bf9731a4fd83cc0d0f5a323e82bc6fe2e Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Sat, 16 May 2026 17:56:42 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20software=20=E2=96=88=20cursor=20blinking?= =?UTF-8?q?=20at=202Hz=20independently=20of=20typing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit position-cursor runs every frame from main loop (after sleep 0.1), drawing █ when cursor-visible-p returns T, space when NIL. This creates a true 2Hz blink that toggles independently of keypresses. Terminal cursor also set to blinking block as fallback. --- org/channel-tui-view.org | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org/channel-tui-view.org b/org/channel-tui-view.org index 367f47d..f22206d 100644 --- a/org/channel-tui-view.org +++ b/org/channel-tui-view.org @@ -327,9 +327,13 @@ Returns a list of strings, one per line." (cl-tty.backend:end-sync fb) (setf (st :dirty) (list nil nil nil)))) +(defun cursor-visible-p () + "Returns T if the software-cursor should be visible this frame (2Hz)." + (evenp (floor (get-internal-real-time) + (floor internal-time-units-per-second 2)))) + (defun position-cursor (fb w h) - "Position terminal cursor at the input insertion point. -Terminal handles the blinking — we just set position and style once per frame." + "Position terminal cursor at input insertion point and draw █ software cursor." (let* ((sw (if (sidebar-visible-p w) (or (st :sidebar-width) 42) 0)) (cw (- w sw)) (hpad 2) @@ -341,7 +345,8 @@ Terminal handles the blinking — we just set position and style once per frame. (cy (- h 6))) (cl-tty.backend:cursor-move fb cx cy) (cl-tty.backend:cursor-style fb :block :blink t) - (cl-tty.backend:cursor-show fb))) + ;; Software █ cursor — erase old position with space, draw new position + (cl-tty.backend:draw-text fb cx cy (if (cursor-visible-p) "█" " ") (theme-color :input-fg) nil))) #+END_SRC * Implementation — v0.7.0 additions