Skip to main content

Module render

Module render 

Source
Expand description

Render layer for the git TUI overlay.

  • plan_overlay / RenderPlan — pure layout math (chunks per pane)
  • pair_split_view — pair removed + added lines per hunk so the side-by-side renderer can align left/right columns with shared context
  • render_sidebar_rows — pure sidebar row builder (text only — no ratatui styles) so the layout can be tested without a terminal
  • minimap_buckets_rows — per-row added/removed ratio for the right-edge minimap strip
  • render_overlay_lines — ratatui draw fn, consumed by render_frame

The layout math is deliberately separated from the draw step so the bulk of the test surface stays in pure helpers.

Structs§

MinimapBucket
One bucket of the minimap: ratio of added vs removed lines on a given screen row (0.0 = pure removal, 1.0 = pure addition).
RenderPlan
Layout plan returned by plan_overlay. One chunk per pane.
SidebarRow
One row of the sidebar (file list).
SplitRow
One paired row of a split view: left = removed-side text, right = added-side text. Either side may be empty (when a hunk has all additions or all deletions).

Functions§

footer_hints
Footer hint line. Returned as a String (not Line) so the test can assert content without bringing in ratatui’s Style.
hunk_scroll_offset
Scroll offset (rows) that brings the selected hunk’s header into the diff pane: min(header offset, overflow). With the header at the pane top when it fits, and pinned to the last pane-height window when the hunk sits near the end of the diff. Pane taller than the whole diff → 0 (no scroll).
minimap_buckets_rows
Bucket a flat list of (line-kind) rows into rows slots so the minimap draws one cell per visible row.
pair_split_view
Pair context / removed / added lines for one hunk into left/right rows suitable for side-by-side rendering.
plan_overlay
Decide how wide each pane should be given the viewport.
render_overlay_lines
Draw the overlay into frame. The caller is expected to have already clipped the frame to a sane area (the brief: overlay REPLACES the scrollback+composer region entirely — render_frame in main_loop.rs handles the area split).
render_sidebar_rows
Build the sidebar rows. staged marks paths with [S] (whatever the user has staged via toggle_stage); unmerged entries always get [U]. Order follows the input entries (which is git status porcelain order).