ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ui renders the chat stream as a full-screen terminal interface.

The design constraint is that a busy channel produces messages far faster than a person can read them: source goroutines must never block on rendering, and rendering must not run once per message. Messages are therefore buffered by sink and handed to Bubble Tea in batches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NickStyle

func NickStyle(nick, color string) lipgloss.Style

NickStyle is the colour a nickname is drawn in, shared with the plain renderer for the same reason as Tag.

func Tag

func Tag(platform string) string

Tag renders the coloured platform badge. Exported so the plain-text renderer can share one definition of what a platform looks like.

Types

type Options

type Options struct {
	Sources    []SourceInfo
	Unified    bool
	Timestamps bool
	Compact    bool
	Scrollback int
	Filter     *filter.Filter
}

Options configures the UI. Filter may be nil, in which case the filter toggle is hidden.

type Program

type Program struct {
	// contains filtered or unexported fields
}

Program is a running TUI.

func New

func New(o Options) *Program

New builds the interface. Nothing is drawn until Run is called.

func (*Program) Dropped

func (p *Program) Dropped() int

Dropped reports messages discarded because the UI could not keep up. It is meaningful only after Run returns.

func (*Program) Quit

func (p *Program) Quit()

Quit asks the interface to shut down, e.g. because a signal arrived.

func (*Program) Run

func (p *Program) Run() error

Run draws until the user quits or Quit is called. It returns once the terminal has been restored.

func (*Program) Sink

func (p *Program) Sink() chat.Sink

Sink returns the chat.Sink to feed sources into. It is safe for concurrent use and never blocks.

type SourceInfo

type SourceInfo struct {
	Label    string
	Platform string
}

SourceInfo describes a source to the UI before it has produced anything.

Jump to

Keyboard shortcuts

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