inline

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 10 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 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) 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) 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