v0.5.0: Text input + keybinding system

Four new modules:
- input.lisp: terminal raw mode, escape sequence parser, key/mouse event
  structs, read-event backend integration
- text-input.lisp: single-line text input with cursor, insertion,
  deletion, ctrl-A/E/W/U/K, on-submit callback, max-length
- textarea.lisp: multi-line text input with cursor up/down, newline,
  backspace joins lines, delete, undo/redo stack
- keybindings.lisp: layered keymap dispatch (global/local/focused),
  defkeymap macro, key spec matching with modifier prefixes

60 test assertions, 100% GREEN:
  RED: 0/12, 0/27, 0/30 — no tests existed
  GREEN: 60/60 across backend (27), box (58), input (60)

Dependencies: sb-posix for terminal raw mode (tcgetattr/tcsetattr)
Test files: 30 input tests covering all widgets and keybinding system
This commit is contained in:
Hermes
2026-05-11 16:31:07 +00:00
parent 2d3227aaf1
commit f07cb65186
9 changed files with 2774 additions and 5 deletions

View File

@@ -2,9 +2,9 @@
(asdf:defsystem :cl-tui
:description "Reusable Common Lisp Terminal UI Framework"
:author "Amr Gharbeia"
:version "0.4.0"
:version "0.5.0"
:license "TBD"
:depends-on (:fiveam)
:depends-on (:fiveam :sb-posix)
:components
((:module "backend"
:components
@@ -22,7 +22,13 @@
(:file "box" :depends-on ("package"))
(:file "text" :depends-on ("package" "box"))
(:file "render" :depends-on ("package" "box" "text"))
(:file "theme" :depends-on ("package")))))
(:file "theme" :depends-on ("package"))
;; Input system (v0.5.0)
(:file "input-package" :depends-on ("package"))
(:file "input" :depends-on ("input-package" "dirty" "box"))
(:file "text-input" :depends-on ("input-package" "input" "box"))
(:file "textarea" :depends-on ("input-package" "input" "box"))
(:file "keybindings" :depends-on ("input-package" "input")))))
:in-order-to ((test-op (test-op :cl-tui-tests))))
(asdf:defsystem :cl-tui-tests
@@ -40,6 +46,14 @@
((:file "box-tests")
(:file "dirty-tests")
(:file "render-tests")
(:file "theme-tests"))))
(:file "theme-tests")
(:file "input-tests"))))
:perform (test-op (o c)
(uiop:symbol-call :cl-tui-backend-test '#:run-tests)))
(dolist (suite '((:cl-tui-backend-test "BACKEND-SUITE")
(:cl-tui-box-test "BOX-SUITE")
(:cl-tui-input-test "INPUT-SUITE")))
(let* ((pkg (find-package (first suite)))
(s (and pkg (find-symbol (second suite) pkg))))
(when s
(fiveam:explain! (fiveam:run s)))))
(uiop:quit 0)))