fix: restore original text-input.lisp in org to fix handle-text-input

The tangled handle-text-input used (key-event-text event) for character
insertion, but the test suite creates key events with :code not :text.
Restored the original handle-text-input which uses
(code-char (key-event-code event)) — matching the test expectations.
This commit is contained in:
Hermes Agent
2026-05-12 17:52:43 +00:00
parent 0fb5309133
commit d5caaf296d
6 changed files with 570 additions and 403 deletions

View File

@@ -59,25 +59,17 @@
(is (eql #\space (cell-char (aref cells 1 1))) "outside scissor is clipped"))))
(test flush-different-sized-fbs-handles-edge-cells
"flush-framebuffer handles prev and curr framebuffers of different sizes
without errors. Cells in the overlapping region are diffed; cells outside
the overlap are silently ignored (no crash on array bounds)."
(let* ((small-fb (make-framebuffer 5 5))
(large-fb (make-framebuffer 10 10))
(be (make-simple-backend :output-stream (make-string-output-stream))))
;; Set a cell in the small one for a change in the overlapping region
(setf (aref small-fb 0 0) (make-cell :char #\X :fg :red))
;; diff-framebuffers should use min dimensions (5,5) — no crash
(let ((changes (diff-framebuffers small-fb large-fb)))
(is (= 1 (length changes)) "one cell changed in overlap region"))
;; flush-framebuffer should also handle different sizes gracefully
(let ((changed (flush-framebuffer small-fb large-fb be)))
(is (= 1 changed) "flush reports 1 changed cell"))
;; Reverse: large as prev, small as curr — extra cells in prev ignored
(setf (aref large-fb 9 9) (make-cell :char #\Y :fg :blue))
(let ((changes2 (diff-framebuffers large-fb small-fb)))
(is (= 1 (length changes2)) "only overlapping region diffed (smaller bounds)"))
;; flush should also work with shrunk framebuffer
(is (= 1 (length changes2)) "only overlapping region diffed"))
(let ((changed2 (flush-framebuffer large-fb small-fb be)))
(is (= 1 changed2) "flush with shrunk fb reports 1 changed cell"))))
@@ -88,8 +80,6 @@
(let ((changed (flush-framebuffer (make-framebuffer 80 24) (fb-framebuffer fb) real-be)))
(is (>= changed 1)))))
;; ── Frame inspection ──────────────────────────────────────────
(test fb-cell-link-url-returns-nil-for-blank-cell
(let ((fb (make-framebuffer 10 10)))
(is (null (fb-cell-link-url fb 5 5)))))