You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a TUI-only rich display mode that renders selected message types with a custom, structured style instead of the flat line form. A toggle switches between the current line view and the rich view.
Rich rendering
RowDescription / ParameterDescription — render each columns data type with a type glyph/icon alongside the type name, keyed on the OIDs in FieldSummary.type_oid (src/decode.rs:35). Map well-known OIDs to glyphs, e.g.:
DataRow — render consecutive rows sharing a column set as an aligned table/grid using ratatuis Table widget, with the column headers and type glyphs coming from the preceding RowDescription.
Glyph reliability (must address)
Terminals cannot render FontAwesome glyphs reliably — it depends on the users font having the codepoints. Decisions to make and document in this issue:
Whether to target Nerd Font codepoints (common in dev fonts) or plain Unicode symbols, or both with a config/env override.
A fallback for missing glyphs (font detection is unreliable, so prefer a safe textual abbreviation, e.g. int4, when the glyph is disabled or a --no-glyphs/env flag is set).
Do not depend on the glyph for correctness — the type name/OID must still be present.
Table batching (design point)
Rendering DataRow as a table requires grouping consecutiveDataRow messages that share the same column set (the most recent RowDescription). Today each DataRow is emitted as an independent event (src/decode.rs:667), so the rich renderer must accumulate DataRows under their current RowDescription until the set ends (next RowDescription, CommandComplete, EmptyQueryResponse, portal suspended, or connection close). Note column sets can change mid-stream (a new query reuses the portal); the grouping logic must reset on a new RowDescription. This is the main behavioural difference from the line view.
Wide data
Tables can exceed terminal width. Decide on behaviour: truncate cells with an ellipsis, allow horizontal scroll, or fall back to the line view when the table does not fit. Keep it simple initially.
Toggle
A new normal-mode keybinding (e.g. r) to toggle rich mode, plus a --tui-rich startup flag (or --rich).
TUI only. The line-oriented stdout output (pcap/mitm without --tui) is unaffected.
Notes
Column/type data already available: FieldSummary (src/decode.rs:33) for OIDs and format codes; format_row_desc/format_oids/format_data_row (src/decode.rs:652-720) are the current line formatters.
Use ratatui Table/Row/Cell for the grid; reuse the existing FieldSummary ↔ DataRow pairing already done for labels.
Goal
Add a TUI-only rich display mode that renders selected message types with a custom, structured style instead of the flat line form. A toggle switches between the current line view and the rich view.
Rich rendering
RowDescription/ParameterDescription— render each columns data type with a type glyph/icon alongside the type name, keyed on the OIDs inFieldSummary.type_oid(src/decode.rs:35). Map well-known OIDs to glyphs, e.g.:int2/int4/int8→#-like numeric glyphfloat4/float8/numeric→ decimal glyphtext/varchar/bpchar/name→ text glyphbool→ checkmarkjson/jsonb→ braces glyphuuid→ fingerprint/uuid glyphbytea→ byte/hex glyphtimestamp/timestamptz/date/time/interval→ clock glyphDataRow— render consecutive rows sharing a column set as an aligned table/grid using ratatuisTablewidget, with the column headers and type glyphs coming from the precedingRowDescription.Glyph reliability (must address)
Terminals cannot render FontAwesome glyphs reliably — it depends on the users font having the codepoints. Decisions to make and document in this issue:
int4, when the glyph is disabled or a--no-glyphs/env flag is set).Table batching (design point)
Rendering
DataRowas a table requires grouping consecutiveDataRowmessages that share the same column set (the most recentRowDescription). Today eachDataRowis emitted as an independent event (src/decode.rs:667), so the rich renderer must accumulate DataRows under their current RowDescription until the set ends (nextRowDescription,CommandComplete,EmptyQueryResponse, portal suspended, or connection close). Note column sets can change mid-stream (a new query reuses the portal); the grouping logic must reset on a new RowDescription. This is the main behavioural difference from the line view.Wide data
Tables can exceed terminal width. Decide on behaviour: truncate cells with an ellipsis, allow horizontal scroll, or fall back to the line view when the table does not fit. Keep it simple initially.
Toggle
r) to toggle rich mode, plus a--tui-richstartup flag (or--rich).:set rich/:set norichslash command. The keybinding is the primary entry point; the slash command is the consistent one.Scope
TUI only. The line-oriented stdout output (
pcap/mitmwithout--tui) is unaffected.Notes
FieldSummary(src/decode.rs:33) for OIDs and format codes;format_row_desc/format_oids/format_data_row(src/decode.rs:652-720) are the current line formatters.Table/Row/Cellfor the grid; reuse the existingFieldSummary↔DataRowpairing already done for labels.