class

Phosphor::HelpWidget(S)

Inherits Phosphor::Widget < Reference < Object

App-specific widget wrapping ViewportMock for the built-in HelpScreen.

Translates raw terminal Events into Msg values (on_event); has nothing to resolve from the theme, so sync is a no-op — HelpScreen sets mock.props directly from app.router once, in on_mount, since the keybinding text never changes for the lifetime of the screen and doesn't depend on the app's own state.

Generic over S — ships with the framework, so it must back HelpScreen(S) for any app's own state type, not just AppState. Fixed to the framework's own Msg as its Widget message type — this widget only ever produces Msg::Back/Msg::ScrollUp/Msg::ScrollDown, not an app-supplied message type.

See DESIGN.md § "Router: your routes.rb".

Constructors

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

Instance methods

handle_cmd(cmd : Cmd) : CmdResult

Delegates to the wrapped ViewportMock's handle_cmd — used by HelpScreen#handle to forward Cmd::ScrollUp/Cmd::ScrollDown.

Source
hit_test(x : Int32, y : Int32) : Bool

Delegates to the wrapped ViewportMock's hit_test.

Source
mock
Source
on_event(event : Event) : Msg | Nil

Maps Key::Escape to Msg::Back (close the help screen) and Up/k, Down/j to Msg::ScrollUp/Msg::ScrollDown (scroll the keybinding list). Returns nil for any other event.

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

Delegates rendering to the wrapped ViewportMock.

Source
sync(state : S) : Void

No-op: mock.props is set directly by HelpScreen#on_mount from app.router, not from the app's own state, and never changes afterward.

Source