Terminal borders that don't cost a cell
A proposed terminal protocol extension draws borders and lines directly on cell edges instead of consuming entire character cells, saving screen space in TUI applications.
read it Provides a thorough technical specification, implementation breakdown, and memory analysis for a novel terminal protocol.
summary
Ratatui maintainer Joshka introduces a terminal protocol extension that renders borders and lines on cell edges rather than using full-cell box-drawing characters. By storing border attributes directly within cell data and using Device Control Strings, the system supports complex layouts, rounded corners, and underlines without sacrificing screen estate. The implementation adds a small memory footprint via a shared lookup table and handles edge cases like scrolling, erasing, and window resizing.
key points
- Cell borders store up to twelve line segments per cell, allowing lines, double strokes, and rounded corners without consuming rows or columns.
- The protocol relies on device control strings to set border pens and rectangles, cleanly falling back to traditional box-drawing characters on unsupported terminals.
- Memory usage stays low because cells pack a 16-bit border ID into existing padding, pointing to a shared table costing at most 15 megabytes.
who should read it
Terminal emulator maintainers and command-line interface developers.
discussion positive
consensus
Readers find the approach clever and aesthetically appealing, engaging deeply with the protocol design, memory implications, and multiplexer compatibility.
pushback
Critics argue that layering more features onto legacy terminal protocols is misguided compared to building a proper monospaced GUI framework.
A much better alternative to this would be to for more terminal emulators to implement overstrike mode (DECSET 20, as available on the VK100). That way you could just draw border characters over existing text cells to achieve the same thing.
Unfortunately mintty is the only terminal emulator I'm aware of which supports overstrike [0], as this would open up a world of new possibilities for TUI apps if more widely supported.
[0] https://github.com/mintty/mintty/wiki/CtrlSeqs#overstrike
Suggests overstrike mode as an existing alternative that achieves similar results without a complex new protocol.
Generated by an LLM from the article and thread. Check the sources before relying on it.