termbox2
What it is
Section titled “What it is”termbox2 is a minimal, single-header C library for terminal I/O — the ncurses alternative you reach for when you want a small, modern, well-tested core without ncurses’ surface area or its terminfo dependency. It exposes a tiny API: an event loop (tb_poll_event), a cell-based virtual screen (tb_set_cell, tb_present), keyboard and mouse input, and a small UTF-8 truetype/wide-char layer. Bindings exist for D, Go, Nim, PHP, Python, Ruby, Rust, Zig, and others — the C ABI is the lingua franca.
Key takeaways for KN-86
Section titled “Key takeaways for KN-86”- The C-core alternative path. If the Deckline runtime turns out to be wrong fit for Go/Bubble Tea (e.g., we want the application binary to be embeddable inside a larger C codebase, or to share a process with the nOSh runtime, or to compile statically with no Go runtime overhead), termbox2 is the lightweight C foundation to fall back on. Bubble Tea remains the default recommendation; termbox2 is the escape hatch.
- Single-header, no dependencies. Drop into a project, compile, done. KN-86’s emulator already compiles C11 (
kn86-emulator/src/) — termbox2 would integrate cleanly with that codebase if we ever want to merge the application runtime with the emulator. - Cell-based virtual screen. Same model as Bubble Tea — set cells, present, the library diffs and emits the right escape sequences. Right granularity for the KN-86 80×25 grid.
- Bindings as a portability story. The C ABI exposing language bindings is exactly the model NoshAPI (
docs/adr/ADR-0005) already takes. termbox2 is prior art for “small C library, many language consumers.” - Mouse + keyboard + UTF-8 + truecolor + 256-color. Everything KN-86 needs from a terminal-I/O perspective is covered. Nothing it doesn’t.
When to pick this over Bubble Tea
Section titled “When to pick this over Bubble Tea”| If you want… | Pick |
|---|---|
| Productive Go application code with declarative styling | Bubble Tea + Lip Gloss |
| Tiny C binary, no runtime, integration with existing C codebase | termbox2 |
| Maximal community + production ecosystem (right now) | Bubble Tea + Lip Gloss |
| Maximal cross-language flexibility (C ABI consumed from N languages) | termbox2 |
To share code with the existing kn86-emulator/ C11 build | termbox2 |
Default recommendation in the synthesis is Bubble Tea + Lip Gloss, but the termbox2 path is the right exit ramp if Go integration costs prove too high.

Source: termbox2 demo/keyboard.gif — the library’s own demo showing keyboard event capture and rendering.
- No layout engine. termbox2 gives you cells and events; it does not give you flexbox, borders, or styling. If you choose this path, you’re hand-rolling layout (or pairing with a separate styling library — though none of the C-world equivalents are as polished as Lip Gloss).
- No built-in component library. No prebuilt text inputs, lists, tables, viewports. You compose from primitives. This is fine for KN-86 because cart-authoring is via KEC Lisp through NoshAPI — but the application code that implements the runtime has to build its own widgets.
- The single-header
termbox2.his the canonical reference. Read it end-to-end; it’s not large.