inline

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event any

type FocusEvent added in v0.11.8

type FocusEvent struct {
	Focused bool
}

FocusEvent reports whether the terminal window gained or lost focus.

type Key

type Key int
const (
	KeyRune Key = iota
	KeyEnter
	KeyTab
	KeyBacktab
	KeyEsc
	KeyBackspace
	KeyDelete
	KeyUp
	KeyDown
	KeyLeft
	KeyRight
	KeyHome
	KeyEnd
	KeyPgUp
	KeyPgDn
	KeyCtrl
)

type KeyEvent

type KeyEvent struct {
	Key  Key
	Rune rune
	Alt  bool
}

type MouseEvent

type MouseEvent struct {
	Kind       MouseKind
	WheelDelta int
	X          int
	Y          int
}

type MouseKind

type MouseKind int
const (
	MouseWheel MouseKind = iota
	MousePress
	MouseDrag
	MouseRelease
)

type Option

type Option func(*Terminal)

func WithIO

func WithIO(r io.Reader, w io.Writer, size func() (int, int)) Option

WithIO replaces the terminal's reader/writer, disabling raw-mode handling — used by tests.

type PasteEvent

type PasteEvent struct {
	Text string
}

type Pos

type Pos struct {
	Row int
	Col int
}

type ResizeEvent

type ResizeEvent struct {
	Width  int
	Height int
}

type Terminal

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

Terminal drives a full-screen application in the alternate buffer: raw mode, input events, and row-diffed frame rendering. All methods must be called from a single goroutine.

func NewTerminal

func NewTerminal(opts ...Option) *Terminal

func (*Terminal) Bell added in v0.11.8

func (t *Terminal) Bell()

Bell requests the terminal's configured audible or visual notification.

func (*Terminal) EnableMouse

func (t *Terminal) EnableMouse(on bool)

EnableMouse turns SGR mouse reporting on or off; off restores the terminal's native text selection.

func (*Terminal) EnterAlt

func (t *Terminal) EnterAlt()

func (*Terminal) Events

func (t *Terminal) Events() <-chan Event

func (*Terminal) ExitAlt

func (t *Terminal) ExitAlt()

func (*Terminal) MouseEnabled

func (t *Terminal) MouseEnabled() bool

func (*Terminal) RenderAlt

func (t *Terminal) RenderAlt(lines []string, cursor *Pos)

RenderAlt draws a full-screen frame, rewriting only rows that changed since the previous frame. cursor, when non-nil, positions and shows the hardware cursor (row is a frame index).

func (*Terminal) Resized

func (t *Terminal) Resized(w, h int)

Resized must be called by the app when it receives a ResizeEvent, before re-rendering.

func (*Terminal) SetTitle added in v0.11.8

func (t *Terminal) SetTitle(title string)

SetTitle updates the terminal window title using OSC 2. Control characters are stripped so workspace names cannot terminate or inject a sequence.

func (*Terminal) Size

func (t *Terminal) Size() (int, int)

func (*Terminal) Start

func (t *Terminal) Start() error

func (*Terminal) Stop

func (t *Terminal) Stop()

Jump to

Keyboard shortcuts

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