fix(tui): Correct input focus and cursor positioning
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s
This commit is contained in:
@@ -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)))
|
(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))))
|
(input-win (make-instance 'window :height 1 :width w :position (list (- h 1) 0))))
|
||||||
|
|
||||||
;; Initial Prompt
|
(setf (keypad-p input-win) t)
|
||||||
(add-string input-win "> ")
|
|
||||||
(refresh input-win)
|
|
||||||
|
|
||||||
(loop while *is-running* do
|
(loop while *is-running* do
|
||||||
;; 1. Handle incoming messages
|
;; 1. Handle incoming messages
|
||||||
@@ -99,7 +97,7 @@ The OpenCortex TUI Client is a standalone Common Lisp application built on **Cro
|
|||||||
(refresh status-win)
|
(refresh status-win)
|
||||||
|
|
||||||
;; 3. Handle Keyboard Input
|
;; 3. Handle Keyboard Input
|
||||||
(let ((ch (get-char scr)))
|
(let ((ch (get-char input-win)))
|
||||||
(when ch
|
(when ch
|
||||||
(cond
|
(cond
|
||||||
((eq ch #\Newline)
|
((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)
|
(when (> (length *input-buffer*) 0)
|
||||||
(decf (fill-pointer *input-buffer*))))
|
(decf (fill-pointer *input-buffer*))))
|
||||||
((characterp ch)
|
((characterp ch)
|
||||||
(vector-push-extend ch *input-buffer*)))))
|
(vector-push-extend ch *input-buffer*))))
|
||||||
|
|
||||||
(clear input-win)
|
(clear input-win)
|
||||||
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
|
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
|
||||||
(refresh input-win)
|
(move input-win 0 (+ 2 (length *input-buffer*)))
|
||||||
|
(refresh input-win))
|
||||||
|
|
||||||
(sleep 0.02))))
|
(sleep 0.02))))
|
||||||
(setf *is-running* nil)
|
(setf *is-running* nil)
|
||||||
|
|||||||
@@ -61,9 +61,7 @@
|
|||||||
(status-win (make-instance 'window :height 1 :width w :position (list (- h 2) 0)))
|
(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))))
|
(input-win (make-instance 'window :height 1 :width w :position (list (- h 1) 0))))
|
||||||
|
|
||||||
;; Initial Prompt
|
(setf (keypad-p input-win) t)
|
||||||
(add-string input-win "> ")
|
|
||||||
(refresh input-win)
|
|
||||||
|
|
||||||
(loop while *is-running* do
|
(loop while *is-running* do
|
||||||
;; 1. Handle incoming messages
|
;; 1. Handle incoming messages
|
||||||
@@ -86,7 +84,7 @@
|
|||||||
(refresh status-win)
|
(refresh status-win)
|
||||||
|
|
||||||
;; 3. Handle Keyboard Input
|
;; 3. Handle Keyboard Input
|
||||||
(let ((ch (get-char scr)))
|
(let ((ch (get-char input-win)))
|
||||||
(when ch
|
(when ch
|
||||||
(cond
|
(cond
|
||||||
((eq ch #\Newline)
|
((eq ch #\Newline)
|
||||||
@@ -101,11 +99,12 @@
|
|||||||
(when (> (length *input-buffer*) 0)
|
(when (> (length *input-buffer*) 0)
|
||||||
(decf (fill-pointer *input-buffer*))))
|
(decf (fill-pointer *input-buffer*))))
|
||||||
((characterp ch)
|
((characterp ch)
|
||||||
(vector-push-extend ch *input-buffer*)))))
|
(vector-push-extend ch *input-buffer*))))
|
||||||
|
|
||||||
(clear input-win)
|
(clear input-win)
|
||||||
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
|
(add-string input-win (concatenate 'string "> " (coerce *input-buffer* 'string)))
|
||||||
(refresh input-win)
|
(move input-win 0 (+ 2 (length *input-buffer*)))
|
||||||
|
(refresh input-win))
|
||||||
|
|
||||||
(sleep 0.02))))
|
(sleep 0.02))))
|
||||||
(setf *is-running* nil)
|
(setf *is-running* nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user