diff --git a/org/channel-tui-view.org b/org/channel-tui-view.org index 9a6ae1a..e68eeb7 100644 --- a/org/channel-tui-view.org +++ b/org/channel-tui-view.org @@ -70,11 +70,6 @@ Returns a list of strings, one per line." ;; No clock, no dot, no text. Everything clean. ) -(defun cursor-visible-p () - "Returns T if the blinking cursor should be visible this frame (2Hz)." - (evenp (floor (get-internal-real-time) - (floor internal-time-units-per-second 2)))) - (defun input-panel-top (chat-w h) "Compute the top row of the input panel based on current input buffer." (let* ((hpad 2) @@ -248,13 +243,9 @@ Returns a list of strings, one per line." (setf cursor-line i cursor-col (- pos accum))) (incf accum (1+ len)))) - ;; Draw software blinking cursor at insertion point - (when (cursor-visible-p) - (let ((cursor-row (+ panel-top 1 cursor-line))) - (cl-tty.backend:draw-text fb (+ hpad 2 cursor-col) cursor-row "█" input-fg nil)))) ;; Hint — lowercase, right-aligned at h-2 (let ((hint "ctrl+p | /help")) - (cl-tty.backend:draw-text fb (- chat-w (length hint) 2) (- h 2) hint hint-fg (theme-color :bg))))) + (cl-tty.backend:draw-text fb (- chat-w (length hint) 2) (- h 2) hint hint-fg (theme-color :bg)))))) #+end_src ** Sidebar @@ -328,13 +319,9 @@ Returns a list of strings, one per line." (position-cursor fb w h) (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 input insertion point and draw █ software cursor." + "Reverse-video cursor (Emacs style): shows the character at cursor position +with foreground and background colors swapped." (let* ((sw (if (sidebar-visible-p w) (or (st :sidebar-width) 42) 0)) (cw (- w sw)) (hpad 2) @@ -343,11 +330,11 @@ Returns a list of strings, one per line." (prompt-w (- cw (* 2 hpad) 2)) (display-start (max 0 (- pos (1- prompt-w)))) (cx (+ hpad 2 (- pos display-start))) - (cy (- h 6))) - (cl-tty.backend:cursor-move fb cx cy) - (cl-tty.backend:cursor-style fb :block :blink t) - ;; 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))) + (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) #+END_SRC * Implementation — v0.7.0 additions