render

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package render walks config lines, calls widget functions, joins non-empty results with the configured separator, and writes each line to an io.Writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w io.Writer, ctx *model.RenderContext, cfg *config.Config)

Render walks config lines, looks up widgets in the registry, joins non-empty results with the configured separator, and writes each line to w.

Unknown widget names are skipped silently (logged at Debug level). Lines where all widgets return empty strings are skipped entirely.

The rendering style for each line is controlled by cfg.Style.Mode (global) and line.Mode (per-line override). Accepted modes:

  • "plain" (default): separator-joined pre-styled strings
  • "powerline": Nerd Font arrow transitions between segments
  • "minimal": space-separated, fg color only, no background or decorators

When ctx.TerminalWidth is at least minTruncateWidth (20), each output line is truncated to that width using ANSI-aware grapheme counting so that escape sequences and wide characters are measured correctly. Truncated lines gain a "..." suffix. Below the minimum, truncation is skipped so that very narrow terminals still receive content rather than collapsing to "...".

When ctx.TerminalWidth is 0 (width detection failed), a defaultTerminalWidth of 120 is used as a safe fallback. Skipping truncation entirely when the width is unknown risks lines wrapping, which causes Claude Code to hide the whole HUD.

The caller is expected to populate ctx.TerminalWidth before calling Render (the gather stage does this via terminalWidth() in gather.go).

Types

This section is empty.

Directories

Path Synopsis
Package widget provides the registry of render functions and shared icon helpers.
Package widget provides the registry of render functions and shared icon helpers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL