Documentation
¶
Overview ¶
internal/tui/statusbar.go
Index ¶
- type StatusBar
- type Writer
- func (w *Writer) Cleanup() error
- func (w *Writer) ClearMessage()
- func (w *Writer) Reset() error
- func (w *Writer) Resize(width, height int) error
- func (w *Writer) SetMessage(msg string)
- func (w *Writer) Setup() error
- func (w *Writer) SetupEscapeHints(proxy *term.EscapeProxy)
- func (w *Writer) UpdateStatus() error
- func (w *Writer) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StatusBar ¶
type StatusBar struct {
// contains filtered or unexported fields
}
StatusBar renders run context at the bottom of the terminal.
func NewStatusBar ¶
NewStatusBar creates a status bar with the given run metadata.
func (*StatusBar) ClearMessage ¶
func (s *StatusBar) ClearMessage()
ClearMessage removes any message overlay and restores normal status bar content.
func (*StatusBar) Render ¶
Render returns the status bar content with ANSI styling. The caller is responsible for cursor positioning and line clearing.
func (*StatusBar) SetDimensions ¶
SetDimensions sets terminal width and height.
func (*StatusBar) SetMessage ¶
SetMessage sets a temporary message overlay that replaces the normal status bar content. This is useful for displaying context-sensitive information like escape sequence hints. Call ClearMessage() to restore normal status display.
func (*StatusBar) SetWarning ¶ added in v0.3.0
SetWarning sets a persistent warning shown in the status bar (e.g. "proxy stale").
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer wraps an io.Writer and adds a status bar at the bottom using a dual-mode approach:
Scroll mode (default): DECSTBM scroll region pins the footer. Output passes through to the real terminal so scrollback works with zero overhead.
Compositor mode: activated when the child process enters alternate screen mode. Output is fed to a VT emulator and the emulator screen is rendered to the real terminal with the footer appended.
Writer is goroutine-safe for all methods.
func NewWriter ¶
NewWriter creates a Writer that composites container output with a status bar. The runtime parameter should be "apple" or "docker" to enable runtime-specific behavior (e.g., detecting Apple container CLI's ready marker).
func (*Writer) ClearMessage ¶
func (w *Writer) ClearMessage()
ClearMessage removes any message overlay and restores normal status display.
func (*Writer) Reset ¶ added in v0.5.1
Reset attempts to recover the terminal from a corrupted state. It exits alternate screen mode if active, drops the VT emulator, emits a soft terminal reset (DECSTR), clears the screen, and re-establishes the scroll region and footer.
Soft reset (ESC[!p) is used rather than full RIS (ESC c) so the user's scrollback is preserved. The caller is responsible for nudging the child process to redraw (typically via a no-op TTY resize).
Reset is best-effort. If the terminal write fails partway through, internal state (altScreen, emulator, footerTimer, escBuf) has already been cleared, so the Writer is left in a valid scroll-mode initial state from which the caller may retry. The scroll region/footer redraw may not have completed.
func (*Writer) Resize ¶
Resize updates the terminal dimensions and re-establishes the layout. This must be called on SIGWINCH to maintain the status bar after terminal resize.
func (*Writer) SetMessage ¶
SetMessage sets a temporary message overlay on the status bar. This replaces the normal status content until ClearMessage is called.
func (*Writer) Setup ¶
Setup initializes the terminal for status bar display using scrolling regions. Sets DECSTBM to create a scrolling region for content (lines 1 to height-1) and pins the status bar at the bottom line.
func (*Writer) SetupEscapeHints ¶
func (w *Writer) SetupEscapeHints(proxy *term.EscapeProxy)
SetupEscapeHints configures the escape proxy to show escape sequence hints in the status bar when Ctrl-/ is pressed.
func (*Writer) UpdateStatus ¶
UpdateStatus updates the status bar content. This is safe to call while the container is running.