fix: demo arrow keys on Widgets tab move cursor instead of switching tabs; +12 keybinding dispatch tests

This commit is contained in:
Hermes Agent
2026-05-12 14:12:53 +00:00
parent baa27f766f
commit a153746111
4 changed files with 223 additions and 9 deletions

View File

@@ -100,15 +100,20 @@
((or (and ctrl (eql key :|C|)) (eql key :escape))
(setf (getf *app* :running) nil) t)
((eql key :tab)
(incf (getf *app* :tab))
(when (> (getf *app* :tab) 2) (setf (getf *app* :tab) 0)) t)
((eql key :left)
(decf (getf *app* :tab))
(when (minusp (getf *app* :tab)) (setf (getf *app* :tab) 2)) t)
((eql key :right)
(incf (getf *app* :tab))
(when (> (getf *app* :tab) 2) (setf (getf *app* :tab) 0)) t)
;; Forward key to widgets only when on the Widgets tab
(incf (getf *app* :tab))
(when (> (getf *app* :tab) 2) (setf (getf *app* :tab) 0)) t)
;; Only arrow keys switch tabs when NOT on the Widgets tab.
;; On the Widgets tab (tab=1), Left/Right are forwarded to widgets
;; for cursor navigation in text inputs.
((and (not (= (getf *app* :tab) 1))
(eql key :left))
(decf (getf *app* :tab))
(when (minusp (getf *app* :tab)) (setf (getf *app* :tab) 2)) t)
((and (not (= (getf *app* :tab) 1))
(eql key :right))
(incf (getf *app* :tab))
(when (> (getf *app* :tab) 2) (setf (getf *app* :tab) 0)) t)
;; Forward key to widgets only when on the Widgets tab
(t (when (= (getf *app* :tab) 1)
(handle-text-input (getf *app* :input) event)
(handle-textarea-input (getf *app* :textarea) event))