Terminal Cell Borders: TUI Layouts Without Wasted Space
Learn how terminal cell borders could give TUI panels, forms and charts cleaner edges without sacrificing rows or columns—and what adoption would require.

Terminal Cell Borders Could Make TUIs Feel Less Boxy
Terminal interfaces have a spacing problem wearing a design problem's costume. A traditional box border is built from line glyphs like ─ and │, and each glyph takes up its own character cell. That means every frame around a panel is also a chunk of layout you can't use for content. In dense TUIs, a few nested panels can chew up rows and columns before you even get to the line you wanted to read.
A proposed terminal feature - cell borders - takes a different approach. Instead of placing line characters inside the grid, it draws thin lines on the edges of cells. The concept has been prototyped in a Ghostty fork and demonstrated in Ratatui apps. If it lands, it could help tabs, text fields, buttons, and chart gridlines fit more naturally into a terminal grid. But it also brings practical questions: compatibility, rendering cost, and what terminal multiplexers will do with the feature.
This article breaks down what cell borders change, where today's "box characters everywhere" approach runs into trouble, how the protocol is designed, and what TUI developers should think about before building on it. One key point up front: this is an experimental protocol, not a capability you can assume exists in every terminal.
What are terminal cell borders?
A terminal grid is made of character cells. In the traditional model, you draw a visible frame using glyphs like ─, │, and ┌. Each glyph is text, so it consumes an entire cell.
Cell borders work differently. The terminal treats the border as line information attached to the cell, and then renders it along the cell's edge.
That changes layout. You can draw a visible outline without reserving an extra row and column on every side. A text label can sit right above an underline. And a one-row button can have a border around it without relying on bracket-like characters or extra padding.
In the proposal, a border is basically a cell attribute, similar to background color. A cell can carry segments on its edges and also from its center. The terminal draws those segments over the grid, while the text stays in its normal cell.
It's also not just about "lines exist." The line can have its own color, width, and style. Corners and joins can be configured too.
This isn't just "here are more Unicode characters." A box-drawing glyph is part of the text stream. A cell border is a terminal-rendered decoration tied to the grid cell. That difference matters: it makes it possible to draw a line between two occupied cells without pushing content aside.
The prototype targets interfaces that split a screen into regions - dashboards, editors, menus, forms, and monitoring tools. The Ratatui demos show the practical difference: with cell borders, pane labels can sit on the top edge, form fields can be underlined directly under the text, and buttons can stay one row tall. With ordinary box characters, the same general layout usually needs more padding, and labels tend to move inside the frame.
If you want a simple mental model: think of cell borders as a layout capability, not a cosmetic theme. They change what fits in a fixed grid - often the real limiter in terminal UI.
Why do box-drawing characters run out of room?
Unicode's Box Drawing block includes lots of glyphs for lines, corners, and intersections, and it's still a solid fallback. The limitation is structural: a border is text, and text lives in the same grid your app uses for content.
The cost is highest in rows
Frames typically consume a cell along every edge. Even one panel can lose a row at the top and bottom, plus a column on the left and right. Then nested layouts multiply that cost fast. In a terminal that's around 50 rows tall, giving away six or eight rows to borders and spacing can noticeably shrink how much information fits on screen.
Columns can feel more forgiving on wide screens, but it depends on the font, terminal sizing, and user preference. The bigger point is straightforward: borders and content compete for the same finite grid.
Lines cannot sit in the boundary between content cells
When a border is text, it has to occupy a cell. That means you either replace a content character or insert blank padding.
So some UI details get awkward. You can't put a line directly below an input field's text without adding an extra row. A compact button often needs brackets, padding, or a larger box. Tabs usually end up inside a frame instead of running along the top edge.
Charts have the same issue. A dense plot might use Braille patterns inside each character cell, but a gridline drawn with box-drawing text still wants cells that the chart needs. With cell borders, the gridline can be placed on the edge while leaving the plotted characters alone.
Typography and copy-paste are part of the problem
With box characters, the font controls how thick the line feels and where it lands. Rounded corners are possible, but they can look wrong when a panel's background doesn't match its surroundings. Those issues aren't impossible to work around - just extra design and rendering trade-offs.
And then there's copy/paste. Because borders are characters, selecting text inside a box can copy the border too. That's sometimes useful when you're copying a table, but it's often clutter when you paste into Slack, a ticket, or a code review. Cell borders wouldn't be copied as text, which avoids that cleanup - though it also means you lose the visible frame when you copy the content out.
Box drawing still makes sense as the broad compatibility baseline, especially for text output that should preserve structure when copied. Cell borders aim at a different goal: richer visuals without sacrificing grid cells.
How does the cell-border protocol work?
The proposed protocol uses DCS, the terminal's control-string mechanism, to send structured commands for features like these. A TUI can set a border "pen," print text, and have the resulting cells inherit the border attribute. It can also use separate rectangle commands to set or clear borders on cells that already exist.
The protocol also includes a capability query. An app checks whether the terminal reports support; if not, it falls back to box-drawing glyphs. This matters because you can't assume a terminal understands a new control sequence just because the sequence is well formed.
Borders behave like cell state
The design stores border data with cells so ordinary terminal operations stay predictable. When text scrolls, inserts, or deletes, its border attributes move with it. Erased cells follow the same general behavior as other cell attributes like background colors.
That also means scrollback, alternate-screen behavior, and reflow can lean on the terminal's existing cell model instead of relying on some separate overlay layer.
Shared edges are handled too. If neighboring cells define strokes on the same edge, the terminal resolves the conflict during rendering. The proposal uses priority first, then stroke width, then a positional tie-break. In practice, that lets one focused pane claim higher priority for its outline rather than losing parts of it to whichever neighbor rendered last.
The feature is intentionally extensible
The first version keeps the minimum feature set small: a pen, rectangle operations, and solid strokes. More advanced properties - dashed or dotted lines, rounded joins, stroke priority, and outside colors - show up as extensions in the capability response. Unknown fields can be ignored.
That's a reasonable approach. Terminal features tend to accrete once developers start using them. A small baseline gives implementers a manageable target, while leaving room for later additions. The version number should be read as the first written draft, not as proof that every design detail is settled.
The prototype describes up to twelve line segments per cell: halves for each of the four edges, plus four arms from the center. Splitting edges into halves helps lines align with quadrant-block-style characters. More granular shapes (like sextants or octants) could work for more complex UI designs, but they also add protocol complexity and implementation cost.
What can TUI developers use cell borders for?
The most direct win is layout space. If your UI has nested panes, a settings form, and dense tables, getting rid of border cells can return space without shrinking type or hiding information. The impact depends on the screen: one outer frame might not matter much, while several nested panels can add up.
Panels, tabs and overlays
A panel can use its whole allocated rectangle for content, while the outline is drawn along the edges. A tab label can interrupt - or simply sit on - the top border without consuming another row.
Popups and menus can also draw outlines over surrounding content. That helps them read as layers rather than as extra text boxes embedded in the page.
This overlay behavior still needs careful testing. If a border draws over cells belonging to another region, both the application and terminal need consistent rules for which strokes "win." Priority helps, but it doesn't remove the need to define ownership and redraw behavior.
Forms and compact controls
Input fields fit particularly well: an underline can sit immediately beneath the entered text. Checkboxes, buttons, and focus outlines can use a real edge instead of ASCII brackets or padding. That makes compact controls easier while keeping alignment with the rest of the terminal grid.
There's a trade-off, though. A frame that isn't text won't survive ordinary copy-and-paste as a visible frame. That's often fine for a button or a single field, but it's less useful for users who paste data into plain-text documents. The rule of thumb: use borders for visual hierarchy, not as the only way to convey structure.
Charts and dense dashboards
Gridlines or average lines can sit between cells without taking away chart rows or covering Braille characters. For dashboards - where charts, status panels, and controls compete for a limited viewport - this can improve information density while preserving the underlying representation.
A practical implementation rule: start with a real fallback path. Your TUI library can expose a logical border style, then render it with cell borders when supported and with box characters, spacing, or omitted gridlines otherwise. That keeps layout decisions in your app, rather than being forced into whatever capabilities a single terminal happens to have.
A practical first-use checklist:
- Identify a real space or alignment problem in the current UI.
- Decide what the fallback should look like on unsupported terminals.
- Test copy-and-paste behavior for content users are likely to export.
- Check focus, overlapping panels, and shared-edge priorities.
- Measure the visual result at different terminal sizes and font settings.
What are the adoption risks and trade-offs?
This only works well as a system if the whole path understands it. A terminal emulator can implement the protocol, but a multiplexer like tmux also tracks and redraws its own view of the cell grid. If it simply passes sequences through without storing and rendering border state, you can get misaligned borders - or they might disappear during redraws.
If a multiplexer doesn't support the feature, it should suppress the sequences and report no support, so the application can fall back. If it does support the feature, it needs to store border attributes and recreate them when redrawing panes. That's real work, not a "just pass it through" change.
Rendering cost is another open question. In the Ghostty prototype, each cell uses a border ID that points to a shared table of border sets; the goal is to fit the ID into existing cell padding so screens without borders don't grow cell size. Rendering only bordered cells adds some overhead, and neighboring cells still need to be considered to resolve shared edges. Straight strokes are likely simpler; antialiased rounded corners require more drawing work.
The author estimated the Ghostty change at roughly 1,650 lines, including tests, and noted that performance wasn't benchmarked yet. That's enough to call it a serious prototype, but not enough to say the performance story is settled. Terminal authors will still need to test real workloads - especially frequently updated dashboards and large areas with rounded borders.
There are also compatibility and UX trade-offs:
- Availability: Until terminals and multiplexers implement the protocol, apps need a fallback.
- Copy behavior: Borders improve on-screen layout, but they won't be present in copied text.
- Visual consistency: Stroke width, antialiasing, and color rendering may differ by terminal.
- Complexity: More border styles and join rules add states for both libraries and terminal authors to support.
- Accessibility: Borders should reinforce grouping, not become the only signal for focus, errors, or selection.
The adoption path is probably incremental. A TUI library can treat borders as a capability and keep a plain-text rendering route. Terminal maintainers can evaluate the minimum protocol independently of optional styles. App developers should avoid making core interactions or critical information depend on the feature until support is widespread.
Conclusion
Cell borders tackle a specific limitation in terminal UI design: text-based frames consume the same rows and columns as the content they surround. Drawing lines on cell edges could make panels, tabs, controls, and chart gridlines fit more cleanly without changing the underlying grid.
The proposal looks promising, but adoption depends on more than just a terminal emulator. Multiplexers, TUI libraries, and applications all need a clear capability and fallback story, and the rendering costs still need broader testing. For now, the practical approach is simple: experiment where reclaimed space solves a real problem, keep box-drawing fallbacks, and don't treat an emerging protocol as a universal baseline.