Skip to main content

Module diff_tui

Module diff_tui 

Source
Expand description

Two-pane diff TUI. Consumes the pure alignment from diff_align::align and renders it as two synchronized lists with one AlignRow per display line. Color coding:

  • Match — default foreground, both sides populated
  • Differ — yellow (structure aligns, content drifted)
  • LeftOnly — left side dim, right side shows the gray “(absent)”
  • RightOnly — symmetric

Navigation mirrors the per-session and corpus TUIs — j/k/g/G/ Home/End/PgUp/PgDn with a ?/F1 help overlay and q/Esc quit.

Synchronized scrolling trick: we share one ListState across both panes’ render_stateful_widget calls. The two panes are the same height (horizontal split of a single vertical slot), so ratatui’s “keep selected visible” offset adjustment produces identical offsets on both sides — the panes scroll together for free without any manual top/height bookkeeping.

Functions§

run
Launch the diff TUI. Caller supplies the already-loaded step vecs so main.rs can reuse the existing load_session path and error handling. Returns when the user quits with q or Esc.