class

Phosphor::StatusLineMock

Inherits Phosphor::MockWidget < Reference < Object

A structured single-row widget rendering multiple labelled segments across the full frame width — mode indicators, file paths, git branch, clock, and similar persistent status displays.

Generic and app-agnostic: no knowledge of AppState, Msg, or the application theme. The Widget wrapper resolves theme → Style values and sets them in Props before each render. Display only — it owns no mutable render state and does not handle input.

Distinct from ParagraphMock: this renders structured, independently positioned fields, not flowing wrapped text.

Constructors

new(props : Props, state : MockWidget::WidgetState = MockWidget::WidgetState.new)

Initialises the status line with props and an optional state. No extra render state is needed beyond the base WidgetState.

Source

Instance methods

handle_cmd(cmd : Cmd) : CmdResult

Display only — always returns CmdResult::None.

Source
props
Source
props=(props : Props)
Source
render_content(frame : Frame, buf : Buffer) : Void

Renders every segment into a single row at frame.y.

Alignment::Left segments pack from frame.x rightward, in declaration order. Alignment::Right segments pack from the frame's right edge leftward, in reverse declaration order — so the last right-aligned segment lands closest to the edge. Alignment::Center segments are treated as one combined block (concatenated in declaration order) and centered in whatever space remains between the rightmost left-aligned segment and the leftmost right-aligned one.

Each segment's text is truncated to its available width — never writing past frame.x + frame.width — via cell-width-aware clipping (Width.of, never String#size). No separator is written between segments; padding is the segment's own responsibility.

Source

Nested types