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