Skip to content
claudewheel.renderer
Edit
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

python
def render(self, bar: SegmentBar, flash: str='', *, notice: str='', show_provenance: bool=False, hints: Sequence[str]=()) -> None

#_hint_line_count

python
def _hint_line_count(self, hints: Sequence[str]) -> int

Return 1 or 2 depending on whether hints wrap to a second line.

#_seg_colors

python
def _seg_colors(self, key: str) -> dict[str, str]

Get per-segment color dict, falling back to empty strings.

#_compute_bar_layout

python
def _compute_bar_layout(self, bar: SegmentBar) -> tuple[list[dict[str, Any]], 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

python
def _compute_viewport(self, layout: list[dict[str, Any]], total_width: int) -> int

Compute 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

python
def _count_offscreen(self) -> tuple[int, int]

Count segments fully off-screen to the left and right of the viewport.

#_render_arrows

python
def _render_arrows(self, buf: list[str], center_row: int) -> None

Render edge arrows with off-screen segment counts when scrolling.

#_render_fan_out

python
def _render_fan_out(self, buf: list[str], bar: SegmentBar, center_row: int, reserved_bottom_rows: int=1) -> None

Render non-selected options vertically above/below the focused segment.

#_render_option

python
def _render_option(self, buf: list[str], seg: Segment, opt_text: str, display: str, option_fg: str, unavail_fg: str) -> None

Render 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

python
def _render_highlighted_option(self, buf: list[str], query: str, opt_text: str, display: str, base_fg: str) -> None

Append 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

python
def _render_minimap(self, buf: list[str], bar: SegmentBar) -> None

Render 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.

#_split_hints

python
def _split_hints(hints: Sequence[str], max_width: int) -> tuple[str, str]

Split hints into two lines, filling the first line greedily.

#_fit_value

python
def _fit_value(self, value: str, min_w: int, max_w: int) -> str

Truncate with ellipsis or pad with spaces to fit width constraints.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search