Terminal borders that don't cost a cell joshka.net · 308 points · 135 comments ·...

@best30

Terminal borders that don't cost a cell joshka.net · 308 points · 135 comments · HN thread

TL;DR Joshka (maintainer of Ratatui) describes a proposed terminal protocol that draws thin border segments on the edges of character cells, so borders no longer consume a row or column. He has a prototype in a Ghostty fork (and earlier in Rio) with a Ratatui demo, and asks terminal and TUI authors for feedback on implementation cost and use cases.

  • Box-drawing characters are glyphs that occupy whole cells, so panels lose a row and column on every side and borders cannot sit tightly against text.
  • The proposal stores up to twelve line segments per cell as a cell attribute, with per-edge color, width, placement and style, and rounded joints.
  • Borders are carried in cells, so they scroll, erase, reflow and survive scrollback like background colors; shared edges are resolved by priority at render time.
  • Transport is a DCS string under a namespace, with a pen in the cursor and a capability query answered before DA1; terminals without support ignore it and apps fall back to box characters.
  • The Ghostty change is about 1,650 lines; each cell gets a 16-bit border ID in existing padding, with a shared table that could reach roughly 10-15 MB in the worst case. Rendering cost, especially for rounded corners, is not yet benchmarked.
  • Multiplexers are the main open question, since tmux and others redraw from their own cell grid and would need to drop or store the borders.

Discussion The thread is split between people excited about a cleaner way to draw borders and charts in TUIs and skeptics who see the work as another step toward turning terminals into GUIs or browsers. Many commenters compare it with alternatives such as overstrike mode (DECSET 20, supported by mintty), SGR 53 overline, X11 and OLE composition, and HTML over SSH. Technical side threads cover tmux pass-through, RAM cost, CJK width ambiguity, and whether borders attach to cells or grapheme clusters. Mood is mostly curious and constructive, with a sizable minority objecting to the AI-written prose and the aesthetic of boxed-in UIs.

  • Borders are useful and the approach is worth exploring (many): Several commenters like the precise, targeted fix for tight-fitting borders, especially for btop-style graphs, panels and rounded corners. Some say it would make Vim and similar TUIs look better.
  • Overstrike or existing escape codes would be simpler (some): Some argue that DECSET 20 overstrike, which mintty supports, or SGR 53 overline could achieve similar results without a new protocol. Others reply that overstrike cannot bound a filled rounded-corner background and lacks color, width and joins.
  • TUIs are drifting toward GUIs and should stay simple (some): A group sees this as reinventing a graphical display inside the terminal and prefers plain text interfaces that compose with pipes and tools. They argue that terminal limits are a feature.
  • Terminals should become a richer UI or semantic protocol (some): Several commenters go further and propose a semantic or UI-oriented terminal protocol, pointing to Emacs, OLE, X11, Plan 9 and projects like bateri. The author agrees that a higher-level layer would help with accessibility, wrapping and scrollback.
  • Concerns about resource use and compatibility (some): Commenters ask about RAM and CPU cost and whether terminals and multiplexers will adopt it. The author estimates the worst-case table at about 25 MB and says it would ship first to Ghostty, Rio and Kitty, not Terminal.app.
  • Objections to the AI-written style and disclosure (a few): A few commenters dislike the AI-assisted prose, the phrasing of the spec and the marketing tone, and say they stopped reading. Others defend the disclosure and say the content stands on its own.

Links from the comments

#terminals #tui #ratatui #ghostty #textUI #protocols