fix: software █ cursor blinking at 2Hz independently of typing

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.
This commit is contained in:
2026-05-16 17:56:42 -04:00
parent f8ae4ac817
commit 5444322bf9

View File

@@ -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