On this page
Renderer class for drawing the segment bar TUI.
#claudewheel.renderer
#claudewheel.renderer
Draw the segment bar, fan-out options, minimap, and scroll arrows.
#Renderer
Renders the segment bar centered, with fan-out options and themed colors.
#render
def render(self, bar: SegmentBar, flash: str='', *, show_provenance: bool=False) -> None#_seg_colors
def _seg_colors(self, key: str) -> dict[str, str]Get per-segment color dict, falling back to empty strings.
#_compute_bar_layout
def _compute_bar_layout(self, bar: SegmentBar) -> tuple[list[dict], int]Compute column positions and widths for each segment without rendering.
Returns (layout, total_width) where layout is a list of dicts with keys: key, col, label_str, label_width, display_value, value_width, has_cursor, is_focused.
#_compute_viewport
def _compute_viewport(self, layout: list[dict], total_width: int) -> intCompute horizontal viewport start offset for narrow terminals.
When the bar fits in the terminal, returns 0. Otherwise, centers the viewport on the focused segment and reserves ARROW_MARGIN on each side for scroll indicators.
#_count_offscreen
def _count_offscreen(self) -> tuple[int, int]Count segments fully off-screen to the left and right of the viewport.
#_render_arrows
def _render_arrows(self, buf: list[str], center_row: int) -> NoneRender edge arrows with off-screen segment counts when scrolling.
#_render_fan_out
def _render_fan_out(self, buf: list[str], bar: SegmentBar, center_row: int) -> NoneRender non-selected options vertically above/below the focused segment.
#_render_option
def _render_option(self, buf: list[str], seg: Segment, opt_text: str, display: str, option_fg: str, unavail_fg: str) -> NoneRender a single fan-out option, applying per-char match highlighting when a search buffer is active and the option is a normal (non-special) entry. Special entries ("+" sentinel, empty placeholder, unavailable, uninstalled) keep their dedicated color and are not highlighted.
When the provenance overlay is active, a dim single-character glyph is prepended to indicate the option's source collection.
#_render_highlighted_option
def _render_highlighted_option(self, buf: list[str], query: str, opt_text: str, display: str, base_fg: str) -> NoneAppend display to buf with chars at fuzzy-matched positions rendered in search_match_fg, others in base_fg. Positions are computed against opt_text but applied to display (which may be truncated/padded); positions outside display's range are dropped, and we exclude the final ellipsis char if the value was truncated.
#_render_minimap
def _render_minimap(self, buf: list[str], bar: SegmentBar) -> NoneRender a minimap of colored blocks in the top-right corner.
Each segment is one block character. Focused segment gets a highlight background; segments with no value are muted; others use their accent color.
#_fit_value
def _fit_value(self, value: str, min_w: int, max_w: int) -> strTruncate with ellipsis or pad with spaces to fit width constraints.