Skip to main content

Module app

Module app 

Source
Expand description

Application state and event handling. App::handle is a pure-ish state transition (no terminal IO) so the whole shell is unit-testable; rendering reads the state in ui::draw. Per-screen state and handlers live in the status, log, and diff submodules.

Modules§

blast
Blast radius of the selected file: which symbols the diff touches and who references them beyond the changed files. Computed against the language server on the runtime side; results land as events like enrichment.
enrich
Background enrichment of diff files: intra-line emphasis, whole-file syntax highlight, and the scope index are CPU-heavy (hundreds of ms on large files) and used to run inside draw. They now run on the blocking pool; the pane renders plain until the result lands as an event.
logs
The CI job-log view: a job’s log grouped into its real steps. Each line is <timestamp> <text> (the REST log; the parser also tolerates gh’s <job>\t<step>\t<timestamp> form). No API exposes per-step log content, so lines are bucketed into the step metadata (name/status/timing from the jobs API) by timestamp: a line belongs to the last step whose start it’s at or after. Without step metadata (e.g. GitLab) it falls back to the runner’s ##[group] markers. Folded by default; keymap-driven like the diff.
pr
The PR review loop against the forge: pull the PR’s line comments into the local session (the same review UI everywhere) and push local comments and replies back out.

Structs§

App
CiRemote
A git remote diffler can pull CI from: its name, the detected forge, and the remote URL the provider is built from.
CommentJump
One row of the comments overview: where it anchors and what to show.
DiffView
FileHighlights
Per-line syntax spans for both sides of one file, keyed by the both-sides content hash so edits to either side invalidate naturally. Filled lazily by the renderer.
FileScope
Enclosing-definition index for one file’s new-side content, keyed by the both-sides hash so edits invalidate it. Drives the sticky scope breadcrumb.
GitOp
A network git op the main loop runs by shelling out, with the terminal kept up: it spawns a blocking task so the event loop keeps drawing, and the result returns as AppEvent::GitDone. Set by a push/pull/fetch leaf.
LogView
OpenTransient
An open transient awaiting its next key. opened_at is a tick count so the which-key reveal timer never reads a wall clock in render.
StatusMessage
StatusView
All state owned by the status screen.

Enums§

BranchAction
What selecting a branch in the branch list does.
CiRequest
What the main loop should fetch from the CI provider off-thread. Mirrors GitOp/pending_git: set by the app, taken once by the loop, result returned as an AppEvent.
CommentLine
One display line of a comment block.
DiffRow
One terminal row of the selected file’s diff body. Indices point into the model the view renders; the row list is rebuilt whenever the selected file, the model, or the session change, so they never dangle. The file field always equals the selected file index, kept so the shared diff_render and anchor helpers read it unchanged.
DiffSource
Flow
What the main loop should do after an event.
InputOp
What an input modal does with its buffer on submit.
Modal
Pane
Which pane has the keyboard: the file sidebar or the diff body.
PendingOp
Deferred operation a modal confirms, kept as data (not a closure) so App::handle stays a pure state transition.
RefreshState
Lifecycle of the off-thread repo refresh: changes queue while a worker runs, so bursts collapse into at most one follow-up run.
Row
One cursor-addressable row of the status screen: section headers, directory rows, file rows, and — when a file is expanded inline — hunk headers and diff lines, plus the trailing Recent commits section. Holds an owned directory path (the fold key), so it is Clone, not Copy.
Screen
Screen stack entry. The per-screen state lives in App::status, App::log, and App::diff; the stack only decides which one is active.
Section
Status screen sections, in display order.
Severity
SplitRow
One row of the side-by-side diff body. left/right index into the hunk’s lines: a context row carries the same index on both sides, a modified row pairs a deletion with an addition, and a lone deletion or addition fills one side with None.

Functions§

comment_display
The terminal lines a comment occupies. Shared by row flattening (for counts) and rendering (for content) so they can never disagree.