class

Phosphor::HelpScreen(S)

Inherits Phosphor::Screen < Reference < Object

Built-in help screen: renders app.router's keybinding reference via a ViewportMock. Mount it with Cmd::Push(HelpScreen) (e.g. from a Key::QuestionMark binding); pressing Escape pops back. Ships as part of the framework so every app gets this for free, without reimplementing it — see DESIGN.md § "Router: your routes.rb".

Generic over S — ships with the framework, so it must work for any app's own state type, not just AppState. Fixed to the framework's own Msg as its Screen message type, matching HelpWidget(S) — this screen only ever handles Msg::Back/Msg::ScrollUp/Msg::ScrollDown, not an app-supplied message type.

Constants

TITLE = "Keybindings — press Escape to close"

Constructors

new(app : App(S, M))
Source

Instance methods

handle(msg : Msg, state : S) : Tuple(S, Cmd | Nil)

Msg::Back (Escape) returns Cmd::Pop, popping back to whatever pushed this screen. Msg::ScrollUp/Msg::ScrollDown (Up/k, Down/j) forward the matching Cmd straight to the mounted HelpWidget — scrolling is the ViewportMock's own render state, not the app's own state, so no with_* state change is involved. Any other Msg is ignored.

Source
on_mount(state : S) : S

Mounts the help viewport, seeded once from app.router.generate_help split into lines — or empty content if App.run wasn't given a Router. The content never changes for the lifetime of this screen, so it's set here rather than every sync. Focuses the viewport so HelpWidget#on_event receives Escape/Up/Down/j/k. No layout decisions here — #render computes geometry every frame.

Source
render(state : S, frame : Frame, buf : Buffer) : Void

Splits frame into a one-row title and the viewport filling the rest. The title is static text, written directly via buf.set_string rather than a dedicated widget.

Source