feat: tui polish - #6
Merged
Merged
Conversation
sunng87
commented
Jul 10, 2026
Owner
- line wrap toggle
- border highlight
- `w` toggles line wrap (Paragraph::wrap, no trim); scroll range widens when wrap is on so the last event stays reachable. - Zebra striping on the packet view, shaded by the terminal's theme: a best- effort OSC 11 query (non-blocking stdin read on unix) detects the default background, with COLORFGBG and a dark fallback. Dark -> Indexed(236), Light -> Indexed(254). - The packet view block gets a green border. Verified via PTY: wrap toggles cleanly, border emits green, zebra emits bg Indexed(236) on dark; clean quit.
- Zebra stripe colour is now DarkGray on dark terminals, Gray on light ones (was Indexed(236)/(254)). - The background now fills the entire row width, not just the cells under the text. Each packet row is rendered as its own widget: a borderless Block paints the full-width background, then the styled text Paragraph is drawn on top. Wrapped events size themselves via Paragraph::line_count (gated by ratatui's unstable-rendered-line-info feature) so multi-row events stay fully striped. Verified via PTY: rows emit bg 48;5;8 (DarkGray) with trailing filler spaces carrying the bg out to the row edge; green border present; wrap toggles; rc=0.
The zebra background didn't read well, so drop it: no per-row background, no OSC 11 / COLORFGBG theme probe. Reverts to a single Paragraph for the packet view. This also removes the now-unneeded libc dependency and ratatui's unstable-rendered-line-info feature (Paragraph::line_count). Kept: the `w` line-wrap toggle and the green packet-view border.
Each event row is separated by a blank line in the default (non-wrap) view. Since a row now occupies two terminal lines, the visible window is halved (log_h.div_ceil(2) events) and the scroll range / follow target adjust so the newest events still land at the bottom. Wrap mode stays dense (per-row spacing there would need per-line height info).
This reverts commit 2c92e00.
In wrap mode max_scroll was len-1, so with follow on the draw window collapsed to events[len-1..len] — a single line (the Terminate), starving the view of the recent stream. Drop the wrap special-case: follow pins to the last log_h events in both modes (short lines are one row; only genuinely long ones wrap/clip).
Previously the wrap viewport rendered a fixed window of log_h events, so multi-row (wrapped) events overflowed and were clipped at the bottom — the newest / multi-line items lost rows. Now the window is sized by display rows: wrap_window fills the viewport with whole items, backward from the newest when following, forward from the scroll anchor otherwise. Item heights come from Paragraph::line_count with .wrap() set (re-enables ratatui's unstable-rendered-line-info feature — the right tool for this; it was only removed along with the zebra experiment). Verified: a 300-char value ending in a sentinel is fully visible (sentinel present) in both follow+wrap and scroll+wrap; no-wrap unchanged.
Wire the BANNER figlet into clap via before_help so it prints at the top of -h/--help. BANNER is now used, so the dead_code workaround is dropped (clippy -D warnings passes cleanly again).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.