tui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

internal/tui/statusbar.go

Index

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

func NewStatusBar(runID, name, runtime string) *StatusBar

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) Content

func (s *StatusBar) Content() string

Content returns the status bar content string (with ANSI styling).

func (*StatusBar) Render

func (s *StatusBar) Render() string

Render returns the status bar content with ANSI styling. The caller is responsible for cursor positioning and line clearing.

func (*StatusBar) SetDimensions

func (s *StatusBar) SetDimensions(width, height int)

SetDimensions sets terminal width and height.

func (*StatusBar) SetGrants

func (s *StatusBar) SetGrants(grants []string)

SetGrants sets the granted credentials to display.

func (*StatusBar) SetMessage

func (s *StatusBar) SetMessage(msg string)

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.

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

func NewWriter(w io.Writer, bar *StatusBar, runtime string) *Writer

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) Cleanup

func (w *Writer) Cleanup() error

Cleanup resets the terminal state.

func (*Writer) ClearMessage

func (w *Writer) ClearMessage()

ClearMessage removes any message overlay and restores normal status display.

func (*Writer) Resize

func (w *Writer) Resize(width, height int) error

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

func (w *Writer) SetMessage(msg string)

SetMessage sets a temporary message overlay on the status bar. This replaces the normal status content until ClearMessage is called.

func (*Writer) Setup

func (w *Writer) Setup() error

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

func (w *Writer) UpdateStatus() error

UpdateStatus updates the status bar content. This is safe to call while the container is running.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Write processes container output, scanning for alternate screen mode transitions. In scroll mode, output passes through directly. In compositor mode, output is fed to the VT emulator for rendering.

Jump to

Keyboard shortcuts

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