Skip to content

Polish the TUI: one visual language across views - #164

Merged
lance0 merged 13 commits into
masterfrom
feat/tui-polish
Oct 16, 2026
Merged

lance0 merged 13 commits into
masterfrom
feat/tui-polish

Conversation

@lance0

@lance0 lance0 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

One visual language across the TUI: the table, title, status bar and every popup now share the same colors, alignment, frame and hint style.

What changed

Colors and themes

  • Default theme uses the terminal's own foreground (Reset) and DarkGray for dim text, so it reads on light terminals; the selection bar maps those to White/Gray.
  • RGB themes whose dim text was under 4.5:1 on their intended background are lifted (matrix, nord, dracula, cyber, gruvbox, catppuccin, tokyo_night, solarized); a test checks every theme.
  • Loss has one scale everywhere: 0 dim, any loss plain text, >=5% warning, >=20% error, never green. The shortcut color is used for keys only.
  • Hops that never replied stay quiet: dim * * *, dim loss, dim Recent crosses.

Table

  • Numeric cells and headers are right-aligned, one decimal for RTTs, loss always {:.1}%; headers carry no per-column units (Loss Sent Last Avg Min Max StDev Jitter), the unit appears once in the title.
  • Loss shows – until the hop has a completed probe.
  • Rate limiting is a separate dim RL tag after the loss instead of 79%RL.
  • Narrow widths: secondary stats go first, ASN yields before Host drops below 18 cells, Sent goes before Last, spare width splits ~60/40 Host/ASN. ASN is omitted with lookups off; Last and Recent are hidden in a static replay.

Title, status bar, popups

  • Title built from spans: ttl bold, target in text with its name dim (an IP target falls back to the destination hop's reverse DNS), flags as badges (PAUSED reversed, RL?, ASYM, NAT, TTL!, MTU …, max_ttl=N), with probe count, interval, local -> gateway dim on the right. Details give way first when narrow.
  • One hint_line helper for the status bar and every popup footer: key bold in the shortcut color, label dim, whole pairs dropped by priority. Transient messages sit right-aligned beside the hints.
  • One popup frame for hop detail, help, settings, target list and Add Target: rounded border, bold title, horizontal padding, hints on the bottom border. The main table uses rounded corners too.
  • Popup text wraps at word boundaries with a hanging indent.

Views

  • Hop detail: section headings, one aligned value grid, only anomalies colored, integer Diff, unquoted interface names, title Hop 10 · host · AS2516 KDDI. The sparkline takes exactly the width beside its range labels (newest samples are no longer clipped) and scales to p5..p95.
  • Help: General / Targets / Navigation / Display (/ Replay) groups with a 10-cell key column, plus a Legend for host markers, the RL tag and title flags. u is listed only while an update banner shows.
  • Target list: one aligned row per target with a full-width selection bar and the destination RTT. Add Target: underlined field, reversed cursor cell, dim placeholder. Update banner uses theme colors. Replay bar reads ▶ 0:45 / 4:23 · 5×.
  • The unused RttSparkline widget is removed.

The dirty-skip fingerprint covers the new target-list RTT field; the small-terminal behavior (whole-column drops, visible selection, paging by visible height) and input handling are unchanged and their tests still pass.

Testing

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test, cargo doc with -D warnings, cargo +1.88 check --all-targets.
  • New render tests: numeric right-alignment and loss formatting, RL tag, loss color thresholds, narrow-width budget, ASN omission, static replay columns, title hierarchy, hint priority dropping, word wrap with hanging indent, sparkline width and outlier scaling, help layout, target list rows, Add Target field, replay label.
  • Live: the TUI in a NET_RAW container at 120x35, 80x24 and 60x16 (light, dark and xterm palettes, all themes, every popup, multi-target, unreachable target, animated and static replay).

lance0 added 13 commits October 16, 2026 12:50
… scale

The default theme now uses the terminal's own foreground (Reset) and
DarkGray for dim text, so it reads on light terminals; the selection bar
maps those to White/Gray. RGB themes whose dim text fell under 4.5:1 on
their intended background are lifted (matrix, nord, dracula, cyber,
gruvbox, catppuccin, tokyo_night, solarized). Loss uses one scale
everywhere: zero is dim, any loss plain text, >=5% warning, >=20% error,
never green. Hops that never replied draw their Recent crosses dim.
Counts and RTTs are right-aligned under right-aligned headers with no
per-column units, all RTTs use one decimal, and loss is always {:.1}%
(never 100% next to 0.0%). Loss shows a dim dash until the hop has a
completed outcome. Rate limiting no longer glues onto the number
(79%RL): the loss keeps its normal format and a dim RL tag follows it.

The narrow-width budget keeps Host readable: ASN yields before Host
drops below 18 cells, Sent goes before Last, spare width is split
~60/40 between Host and ASN, and ASN is omitted with lookups off. A
static replay hides Last and Recent, which describe nothing there.
ttl leads in the header color, then the target in text with its name
dim (an IP target falls back to the destination hop's reverse DNS).
Flags follow as small badges in warning/success colors, PAUSED
reversed, without brackets. Probe count, interval, local -> gateway
and the RTT unit sit dim and right-aligned, and give way first on
narrow borders so flags stay whole. The table frame uses rounded
corners to match the popups.
A shared hint_line helper renders key hints the same way everywhere:
key bold in the shortcut color, label dim, two spaces between pairs,
dropping whole pairs from the end by priority until the line fits. It
replaces the hard-coded '·' and '|' hint strings. Transient status
messages (exports, theme changes) sit right-aligned on the same row
instead of replacing every hint, and the status bar no longer repeats
the update banner.
Hop detail, help, settings, the target list and Add Target now use one
popup helper: cleared, rounded border in the theme's border color, the
title bold in the header color, one column of horizontal padding, and
key hints on the bottom border in the shared hint style (replacing the
per-popup footer strings).

wrap_lines breaks at the last space that fits and continues under the
line's own leading indent instead of splitting words and dropping the
indent; words longer than the width still break between graphemes.
Section headings (Latency, Jitter, Routing Symmetry, TTL Behavior,
Interface, MPLS, ...) are bold in the header color, or warning when
they report an anomaly. Values sit in one grid of fixed-width labels
and right-aligned values with one decimal and the unit once per value,
matching the table. Only anomalies are colored: normal sample counts
are no longer green, Diff is an integer, interface names are unquoted
in text color, and the IX name is no longer in the key-hint color. The
title reads 'Hop 10 · host · AS2516 KDDI'.

The sparkline now takes exactly the width left beside its range labels
(164 ▁▂▁█ 485 ms), so the newest samples are never clipped, and scales
to the p5..p95 range so one spike cannot flatten it. The unused
RttSparkline widget is removed.
Help is grouped under General, Targets, Navigation, Display (and
Replay when replaying) with a 10-cell key column, so keys such as
'p Space' or 'S-Tab N' never run into their descriptions. A Legend
explains the host markers (E ! ~ ^ +), the RL tag and Recent symbols,
and the title flags (RL? ASYM NAT TTL! MTU max_ttl). 'u Dismiss update
banner' is listed only while a banner is showing.
The target list shows one aligned row per target (number, address,
name, hops, loss, RTT at the destination) with a full-width selection
bar; an IP target falls back to the destination hop's name. Add Target
draws a visible underlined field with a reversed cursor cell and a dim
'Hostname or IP address' placeholder. The update banner uses theme
colors instead of hard-coded black on yellow. The replay bar reads
'▶ 0:45 / 4:23 · 5×' without event counts. Settings highlights the
focused value in the header color, keeping the shortcut color for keys,
and drops the indent the popup padding now provides.
A loaded file has nothing probing, so p and o do nothing there; the
status bar now lists only keys that act on a static replay.
When --no-update-check, DO_NOT_TRACK/TTL_NO_UPDATE_CHECK or the build
locks the update check off, its Settings row reads e.g. '[off]  set by
--no-update-check' in dim text instead of offering a toggle that does
nothing.
@lance0
lance0 marked this pull request as ready for review October 16, 2026 17:34
@lance0
lance0 merged commit da314b4 into master Oct 16, 2026
6 checks passed
lance0 added a commit that referenced this pull request Oct 16, 2026
Indicators are now unbracketed title badges (NAT, RL?, ASYM, TTL!, MTU, max_ttl=N, PAUSED) and a dim RL tag after the loss value; INSTALL, KNOWN_ISSUES and the doc index use the new names. KNOWN_ISSUES records that --pmtud is rejected with -p udp/tcp, that replies behind destination NAT are only kept for a single target, and moves instance cross-talk and silent-hop RL flags to Resolved. CHANGELOG gains entries for #163, #164 and #162.
lance0 added a commit that referenced this pull request Oct 16, 2026
* Fix doc claims that drifted from the code

- SCRIPTING: jq recipes used fields that do not exist in the JSON export
  (is_destination, loss_percent, avg_ms, nat_detected) and indexed the
  responders object by position. Rewritten against the real schema, with a
  field table, and the exit-code section no longer implies that exit 0
  means the destination was reached.
- FEATURES: the PeeringDB cache refresh key is Ctrl+R, not r; replay speed
  range is 0.1x-1000x (also > and <); --flows examples now use UDP/TCP,
  since ICMP ignores flows; --pmtud only probes in ICMP mode and conflicts
  with --size; --resolve-all keeps both address families; the config file
  lives under ~/Library/Application Support on macOS. Adds a Detection
  Indicators section, a Config File section, overlay keys, and a CLI
  reference that matches --help (adds --no-update-check, --completions,
  ranges and mode conflicts).
- ARCHITECTURE: module tree, struct locations and field types (ProbeId.seq
  is u8, Hop lives in session.rs, flow_paths not flow_stats).
- SECURITY: supported versions now 0.23.x.
- ROADMAP: add the current-release line.

* Move install, troubleshooting and limitations out of the README

The README becomes a short front door: pitch, quick start, a "What it
finds" list linking to the feature reference, a compact install list,
platform support, and a task-based documentation table.

- docs/INSTALL.md (new): every install channel, permissions (Linux
  setcap, macOS/BSD sudo, containers), shell completions, Windows/WSL2,
  download verification (moved from FEATURES.md), and troubleshooting.
  Lists the aarch64 musl release archive the table was missing.
- KNOWN_ISSUES.md: now the single home for limitations (merged from the
  README). Drops stale entries now resolved in code: the 500us BSD
  inter-probe delay, NetBSD IPv4 PMTUD, and TCP ignoring --rate. Removes
  the ping_group_range claim, which ttl does not use.
- COMPARISON.md: points to INSTALL.md for WSL2 setup instead of repeating
  it, and lists Windows as WSL2-only.
- Every removed README heading keeps its anchor as an <a id> placeholder,
  so existing links to #installation, #permissions-linux,
  #troubleshooting, the use-case sections and others still resolve.

* Add a documentation index

docs/README.md lists every page by area with a one-line scope. CONTRIBUTING points new-feature docs at FEATURES.md and the index rather than the README, lists FreeBSD/NetBSD as experimental tracing platforms, and uses the same clippy command as CI.

* Match docs to the merged TUI polish and correlation fixes

Indicators are now unbracketed title badges (NAT, RL?, ASYM, TTL!, MTU, max_ttl=N, PAUSED) and a dim RL tag after the loss value; INSTALL, KNOWN_ISSUES and the doc index use the new names. KNOWN_ISSUES records that --pmtud is rejected with -p udp/tcp, that replies behind destination NAT are only kept for a single target, and moves instance cross-talk and silent-hop RL flags to Resolved. CHANGELOG gains entries for #163, #164 and #162.
@lance0
lance0 deleted the feat/tui-polish branch October 16, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant