fix: solid amber █ cursor with finish-output flush

Replaced reverse-video cursor with a solid █ block in :input-prompt
color (amber). Drawn at the insertion point every frame from redraw
and main loop. finish-output ensures the cursor escape reaches the
terminal immediately.
This commit is contained in:
2026-05-16 18:29:49 -04:00
parent c568ac6842
commit 2fedbbcb3b

View File

@@ -320,8 +320,7 @@ Returns a list of strings, one per line."
(setf (st :dirty) (list nil nil nil))))
(defun position-cursor (fb w h)
"Reverse-video cursor (Emacs style): shows the character at cursor position
with foreground and background colors swapped."
"Draw a solid block cursor █ at the input insertion point."
(let* ((sw (if (sidebar-visible-p w) (or (st :sidebar-width) 42) 0))
(cw (- w sw))
(hpad 2)
@@ -330,11 +329,9 @@ with foreground and background colors swapped."
(prompt-w (- cw (* 2 hpad) 2))
(display-start (max 0 (- pos (1- prompt-w))))
(cx (+ hpad 2 (- pos display-start)))
(cy (- h 6))
(ch (if (< pos (length text)) (char text pos) #\Space)))
(cl-tty.backend:draw-text fb cx cy (string ch)
(theme-color :bg) ;; fg = global bg (black)
(theme-color :input-fg)))) ;; bg = text color (reverse)
(cy (- h 6)))
(cl-tty.backend:draw-text fb cx cy "█" (theme-color :input-prompt) nil)
(finish-output (cl-tty.backend::backend-output-stream fb))))
#+END_SRC
* Implementation — v0.7.0 additions