Skip to main content

Crate tb_tui_common

Crate tb_tui_common 

Source
Expand description

tui-common — shared helpers used by ratatui-based TUIs ebman and pgman (and any future siblings).

What lives here:

  • font_probe — pre-TUI terminal probe that decides whether the user’s font renders Powerline / Nerd Font glyphs at one cell each.
  • overlay — centred-popup sizing (OverlaySize categories + centered_overlay / centered_rect helpers).
  • text_input — single-line editable buffer with a cursor (TextInput) for modal prompts / filter / command lines.

What does not live here: anything app-specific (AWS SDK clients, Postgres connection code, EB-flavoured theme palettes, …). Pure reusable plumbing only.

Re-exports§

pub use text_input::TextInput;

Modules§

font_probe
Detect whether the current terminal’s font renders Powerline / Nerd glyphs as a single cell. We can’t actually inspect the font from a TUI, but we can write a known Powerline triangle (U+E0B0) and ask the terminal where the cursor ended up. A patched font draws the glyph in one cell — cursor advances by 1. An unpatched font usually substitutes the placeholder block which most terminals render as a “wide” character, advancing the cursor by 2 — or, more commonly, falls back to the tofu/replacement character which most terminals render in one cell but at an obviously wrong baseline (we can’t tell from here, but the cell count is at least stable). We treat advance-by-1 as “supported” and anything else as “not supported”.
overlay
Centred-overlay sizing for ratatui popups.
splash
Generic pixel-art frame renderer for ratatui splash / about scenes.
text_input
A minimal single-line editable text buffer for TUI prompts — modal value entry, rename fields, filter / command lines. Prompts used to hand-roll append-only editing (Backspace/Char only); this owns the text plus a cursor and the editing operations once, so prompts behave consistently and a fix here (cursor movement, word-delete, paste) lands everywhere that uses it.
theme
Theme primitives shared across TUI apps.
util
Tiny generic helpers shared across TUI apps. Anything in here must be app-neutral — no config-dir layout, no flavour-specific conventions. Bigger or more opinionated helpers belong in their own module.