fix(tui): Correct input focus and cursor positioning
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s

This commit is contained in:
2026-04-19 13:18:48 -04:00
parent 309b8ee8a7
commit 06361847f8
2 changed files with 16 additions and 18 deletions

View File

@@ -74,9 +74,7 @@ The OpenCortex TUI Client is a standalone Common Lisp application built on **Cro
(status-win (make-instance 'window :height 1 :width w :position (list (- h 2) 0)))
(input-win (make-instance 'window :height 1 :width w :position (list (- h 1) 0))))
;; Initial Prompt
(add-string input-win "> ")
(refresh input-win)
(setf (keypad-p input-win) t)
(loop while *is-running* do
;; 1. Handle incoming messages
@@ -99,7 +97,7 @@ The OpenCortex TUI Client is a standalone Common Lisp application built on **Cro
(refresh status-win)
;; 3. Handle Keyboard Input
(let ((ch (get-char scr)))
(let ((ch (get-char input-win)))
(when ch
(cond
((eq ch #\Newline)
@@ -114,11 +112,12 @@ The OpenCortex TUI Client is a standalone Common Lisp application built on **Cro
(when (> (length *input-buffer*) 0)
(decf (fill-pointer *input-buffer*))))
((characterp ch)
(vector-push-extend ch *input-buffer*)))))
(clear input-win)
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
(refresh input-win)
(vector-push-extend ch *input-buffer*))))
(clear input-win)
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
(move input-win 0 (+ 2 (length *input-buffer*)))
(refresh input-win))
(sleep 0.02))))
(setf *is-running* nil)

View File

@@ -61,9 +61,7 @@
(status-win (make-instance 'window :height 1 :width w :position (list (- h 2) 0)))
(input-win (make-instance 'window :height 1 :width w :position (list (- h 1) 0))))
;; Initial Prompt
(add-string input-win "> ")
(refresh input-win)
(setf (keypad-p input-win) t)
(loop while *is-running* do
;; 1. Handle incoming messages
@@ -86,7 +84,7 @@
(refresh status-win)
;; 3. Handle Keyboard Input
(let ((ch (get-char scr)))
(let ((ch (get-char input-win)))
(when ch
(cond
((eq ch #\Newline)
@@ -101,11 +99,12 @@
(when (> (length *input-buffer*) 0)
(decf (fill-pointer *input-buffer*))))
((characterp ch)
(vector-push-extend ch *input-buffer*)))))
(clear input-win)
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
(refresh input-win)
(vector-push-extend ch *input-buffer*))))
(clear input-win)
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
(move input-win 0 (+ 2 (length *input-buffer*)))
(refresh input-win))
(sleep 0.02))))
(setf *is-running* nil)