Skip to content

Typeinc

Typeinc is a terminal typing-speed test. Its distinguishing feature — the reason it’s in the corpus — is the monitor-plus-keyboard UI: as you type, an ASCII rendering of a keyboard on screen lights up the keys you press, and highlights which key should be pressed next. The README’s own framing: “a really cool UI with a monitor and a KEYBOARD which gets typed when you type.” The widget visually mirrors the physical input surface, so the operator’s eyes can stay on screen and still see the keyboard.

Other features (difficulty tiers from “Super Easy” to “GOD BRUH!!!”, per-difficulty grading, WPM + accuracy, top-10 highscore table) are conventional typing-test fare. The keyboard widget is the load-bearing idea for KN-86 — and the README is candid that “Not all keys are functional,” and that typeinc-mini exists precisely because the keyboard widget is the part that needs screen real estate. The widget is the feature; everything else is the harness around it.

License: not stated in the README. Treat as technique reference only — KN-86 reimplements the keyboard-widget concept from first principles against its own layout; no code is vendored.

KN-86 relevance — the (draw-keyboard) widget (A4)

Section titled “KN-86 relevance — the (draw-keyboard) widget (A4)”

The KN-86 has something Typeinc doesn’t: a specific, opinionated, documented physical input surface — the Ferris Sweep 34-key split with the function-block legend (Lisp primitives on the left half, digits + punctuation + ENT on the right; see CLAUDE.md Canonical Hardware Specification and ADR-0022 / ADR-0031). A KN-86 (draw-keyboard) widget renders that specific keyboard on the 128×75 grid, and the synthesis-L1 line — “the keymap is discoverable in-band” — becomes literally true: the deck can draw its own input surface back at the operator.

Concrete uses for a KN-86 (draw-keyboard):

  • In-band keymap discovery. The function-block legend (NIL / LAMBDA / CONS / CAR / CDR / EVAL / QUOTE …) is dense and unusual. A operator who forgets where CDR lives presses a help chord and the deck draws the keyboard with every key labeled. No paper card, no external reference — the deck is the reference.
  • SYS keyboard-test utility. The SYS tab already owns device diagnostics. A keyboard-test surface that draws the split layout and lights each physical key as it’s pressed is the canonical “is my hardware working” check during bring-up and in the field — directly Typeinc’s light-up-on-press behavior, repurposed as a diagnostic.
  • Tutorials / onboarding. First-boot and the REPL/nEmacs tutorials (ADR-0008 / ADR-0016) can highlight the next key to press — “press LAMBDA (left home row, index)” with that key lit on the drawn keyboard. Typeinc’s highlight-the-next-key behavior is exactly this.
  • Showing cart key bindings. A cart that rebinds keys (or layers contextual bindings on TERM per ADR-0016) can call (draw-keyboard :highlight …) to show the operator its active bindings on the real layout, rather than listing them as text.

Sketch — (draw-keyboard :layout … :highlight …)

Section titled “Sketch — (draw-keyboard :layout … :highlight …)”

A NoshAPI primitive (names indicative; finalize in the FFI catalog). It renders the 34-key split plus the function-block legend into a sub-region of the cart-usable rows (1..73), using box-drawing glyphs for key caps and the cell-set/cell-print cell API (ADR-0027) for legends. Because the grid is now 128 columns (ADR-0027, not the 80 the original brief assumed), a full split keyboard with both halves and legends fits comfortably side-by-side with room for a status column — the 128-wide grid is what makes a legible full-layout render practical.

(draw-keyboard
:layout :ferris-sweep ; :ferris-sweep (default) | :base | :shift (MO(L1) secondaries)
:legend :function-block ; :function-block (Lisp primitives + digits) | :blank | :char
:highlight '(LAMBDA CDR) ; list of key ids drawn in inverted / brightened amber
:pressed '(EVAL) ; momentary press feedback (SYS keyboard-test live mode)
:region (rect 1 40 128 30)) ; col row w h within rows 1..73

Rendering model on 128×73:

  • Two key clusters (left 3×5 + 2 thumb, right 3×5 + 2 thumb) drawn as box-drawing key caps, mirroring the physical split with a gutter between halves. Press Start 2P at native 8×8 (ADR-0027) means a 3-char legend (CDR, NIL, ENT) fits inside a key cap cleanly.
  • Legend layer writes each key’s printed function into its cap — left half carries the 14 Lisp primitives, right half the digit 3×3 + punctuation + ENT, per ADR-0031 §3.1. :layout :shift redraws the shift-secondary legends.
  • :highlight draws listed keys in inverted or brightened amber (the deck’s only color is amber #E6A020 on black; “highlight” is an intensity/inversion treatment, not a hue — cross-link ascii-effects.md brighten).
  • :pressed is the live SYS-test feedback path — a momentary inversion on physical keydown, decaying on keyup. This is Typeinc’s “keyboard gets typed when you type” behavior, exactly.

The widget is read-only chrome — it draws the input surface; it does not capture input. Input policy stays in nOSh (ADR-0027 §“Decision” item 5); (draw-keyboard) is a renderer the runtime feeds with already-classified key state.

Typeinc uses color-coded keys for active/next/typed states. KN-86 is monochrome amber-on-black, so the three states collapse onto an intensity + inversion axis rather than hue:

Typeinc stateKN-86 amber-only treatment
Idle keyDim amber cap outline, mid-amber legend
Next-key hintBrightened amber legend (cross-link ascii-effects.md brighten, brightness 2.0)
Active / just-pressedInverted cell pair (black glyph on solid amber cap) via cell-set fg/bg swap
Disabled / non-functionalCap drawn, legend omitted (no KN-86 key is non-functional, so this state is unused — every key on the Sweep does something)

The inversion treatment is free on the cell API: (cell-set col row ch +black+ +amber+) for a pressed cap vs +amber+ +black+ for idle. No hue, no second color, no compromise to the monochrome rule.

  • A4 source-of-record. This entry is the raw material for the A4 keyboard/framebuffer synthesis — specifically the (draw-keyboard) half. The companion A4 question (how (draw-framebuffer pixels) reconciles with the existing half-block canvas) is treated in cbonsai.md and the libuv/synthesis cross-cut, not here.
  • The 128-wide grid is what unlocks this. Under the retired 80×25 grid (ADR-0014, superseded by ADR-0027), a full split-keyboard render with both halves and legends would have been cramped. At 128×73 it’s comfortable — this is a concrete payoff of the ADR-0027 widening, worth citing when the widget is specced.
  • typeinc-mini is the honest caveat. Even Typeinc’s author drops the keyboard widget when screen space is tight. KN-86 should treat (draw-keyboard) as a full-screen-or-large-region affordance (help overlay, SYS test, tutorial step), not a persistent always-on chrome element. It earns its space when summoned, then yields.
  • Cross-link opentui.md and tuibox.md for the box-tree / region-composition model the widget renders within.
  • Cross-link ascii-effects.md for the brighten treatment that does the monochrome “highlight.”
  • Cross-link ADR-0022 / ADR-0031 (keyboard layout + function-block legend) — the widget renders that layout; the legend content is canonical there, not invented here.