hn.today

Terminal borders that don't cost a cell

joshka.net312 points136 comments
Screenshot of Terminal borders that don't cost a cell

Terminal box-drawing characters consume rows and columns, constrain where lines can sit, and become part of copied text. A proposed alternative, “cell borders,” draws lines on cell edges as visual attributes rather than characters. In a Ratatui tiling-window demo running on a patched Ghostty, borders outline panes without reducing their content area; tabs sit on pane edges, text fields are underlined directly beneath their text, and one-row buttons can have rounded outlines. The same approach adds gridlines and average lines to dense braille charts without sacrificing graph cells. Borders also make panels and popups clearer, though they are omitted when copying text, which avoids stray box characters but means the borders themselves cannot be copied.

The protocol stores up to twelve configurable line segments per cell, with options for color, width, placement, and style. Adjacent segments merge; conflicts resolve by priority, then width, then a consistent directional rule, allowing focused panes to retain their outlines. A compact DCS command sets borders while text is printed, with additional commands for changing existing cells and checking terminal support. Unsupported terminals can ignore the commands, allowing applications to fall back to box characters and reserve space as usual. Borders follow cells through scrolling, erasing, and reflow; multiplexers must understand the protocol to preserve them correctly, or should suppress it and trigger fallback. The Ghostty implementation uses shared border sets and fits cell IDs into existing padding, so cells do not grow and terminals without borders incur no added storage.

Read on joshka.net136 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Ggml v1.0.0

Ggml v1.0.0

ggml 1.0.0 removes deprecated public APIs and legacy DIAG_MASK operations, while adding configurable YaRN truncation and FP8 support. It also improves backend performance with quantized matrix multiplication, fused MoE operations, and new attention and scheduling paths. (github.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.