v0.0.1: Backend Protocol — abstraction layer + simple backend #2

Merged
amr merged 6 commits from feature/v0.0.1-backend-protocol into main 2026-05-11 10:30:54 -04:00
Owner

Implements: v0.0.1 from ROADMAP.org

Backend protocol — 18 generic functions for terminal rendering. Two backend classes: backend (abstract base) and simple-backend (ASCII, universal compatibility). Modern backend (raw escape sequences) deferred to a follow-up.

9 FiveAM tests, all GREEN.

Adds:

  • org/backend-protocol.org — literate source file
  • docs/ARCHITECTURE.org — full architecture doc
  • cl-tui.asd — ASDF system definitions
  • backend/package.lisp, backend/classes.lisp, backend/simple.lisp, backend/tests.lisp

To review: Check the generic function signatures in classes.lisp and the simple backend implementation in simple.lisp. The protocol is meant to be minimal — every function is something a real TUI needs. If anything looks missing or wrong, I can adjust before merging.

Next up: modern-backend (raw escape sequences, truecolor, DECICM sync).

**Implements:** v0.0.1 from ROADMAP.org **Backend protocol** — 18 generic functions for terminal rendering. Two backend classes: `backend` (abstract base) and `simple-backend` (ASCII, universal compatibility). Modern backend (raw escape sequences) deferred to a follow-up. **9 FiveAM tests, all GREEN.** **Adds:** - `org/backend-protocol.org` — literate source file - `docs/ARCHITECTURE.org` — full architecture doc - `cl-tui.asd` — ASDF system definitions - `backend/package.lisp`, `backend/classes.lisp`, `backend/simple.lisp`, `backend/tests.lisp` **To review:** Check the generic function signatures in `classes.lisp` and the simple backend implementation in `simple.lisp`. The protocol is meant to be minimal — every function is something a real TUI needs. If anything looks missing or wrong, I can adjust before merging. Next up: modern-backend (raw escape sequences, truecolor, DECICM sync).
amr added 2 commits 2026-05-11 08:45:37 -04:00
Implement the backend protocol with two backends (modern planned,
simple done). Includes package definitions, CLOS generic protocol,
simple-backend with ASCII borders, and 9 FiveAM tests.

RED: 9/9 tests failing (no implementation)
GREEN: 9/9 tests passing

- backend/package.lisp — defpackage, exports
- backend/classes.lisp — backend base class, 18 generics
- backend/simple.lisp — simple-backend implementation
- backend/tests.lisp — 9 FiveAM test cases
- org/backend-protocol.org — literate source
amr added 1 commit 2026-05-11 08:53:56 -04:00
Implements the modern-backend with truecolor SGR, Unicode box-drawing
(rounded/double/single), DECICM synchronized updates, OSC 8 hyperlinks,
cursor style control, and hex color parsing.

RED: 32 checks, 5 fail (class forward-ref + test bug)
GREEN: 32/32 checks passing (100%)

- backend/modern.lisp — escape generators + modern-backend class
- backend/modern-tests.lisp — 16 test cases, 32 assertions
- backend/package.lisp — updated exports
- org/modern-backend.org — literate source
amr added 1 commit 2026-05-11 09:12:36 -04:00
amr added 1 commit 2026-05-11 09:39:28 -04:00
Fixes during debugging:
- Variable scope: loop's closing parens closed the let* prematurely,
  making children/is-row/pr/pb undefined in own-size calculation
- gap NIL bug: make-layout-node passed :gap nil (from &key default)
  to make-instance, overriding :initform 0 → (* nil ...) crash
- Child order: push (LIFO) in add-child reversed children order;
  changed to nconc (FIFO), removed the compensating reverse
- Fixed distribute-sizes to base all children from their fixed size
  then apply grow/shrink on top, instead of treating fixed-size
  children as non-participating
amr added 1 commit 2026-05-11 10:08:53 -04:00
B1: modern-backend now inherits from backend (was standalone class)
B2: draw-rect y-position bug — loop now tracks row offset
B3: Layout module added to ASDF system definition
I1: 6 smoke tests replaced with behavioral tests (captured output)
I3: 6 edge case tests: empty, single-child, zero-size, deep
    nesting, large padding, negative grow

Also fixed:
- Added missing make-simple-backend constructor to simple.lisp
- Added in-package to classes.lisp and simple.lisp (SBCL's load
  restores *package* after each load, breaking batch-mode loading)
amr merged commit 76f4477313 into main 2026-05-11 10:30:54 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: amr/cl-tty#2