terminal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package terminal gives TSX nsgo/base's Terminal, base/terminal's View over a session of its own, which links libghostty-vt's binding: an app whose TSX uses it imports this package for its effect.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ref

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

Ref is a Terminal's ref: the view's selection and clipboard, and the session's cursor, title and directory.

func (*Ref) ClearSelection

func (r *Ref) ClearSelection()

func (*Ref) Copy

func (r *Ref) Copy()

func (*Ref) Dir

func (r *Ref) Dir() string

Dir is the program's working directory, as the shell reports it.

func (*Ref) Focus

func (r *Ref) Focus()

func (*Ref) FontSize

func (r *Ref) FontSize() core.Points

func (*Ref) Paste

func (r *Ref) Paste()

func (*Ref) Perform

func (r *Ref) Perform(action terminal.Action, amount core.Points) bool

func (*Ref) SelectAll

func (r *Ref) SelectAll()

func (*Ref) Selected

func (r *Ref) Selected() bool

func (*Ref) Send

func (r *Ref) Send(text string)

Send writes text to the program as typed.

func (*Ref) SetCursor

func (r *Ref) SetCursor(c terminal.CursorStyle)

SetCursor sets the cursor's shape until a program changes it.

func (*Ref) SetFontSize

func (r *Ref) SetFontSize(size core.Points)

func (*Ref) Title

func (r *Ref) Title() string

Title is what the program last set as its title.

type Terminal

type Terminal struct {
	// The session, as terminal.Options.
	Command     []string
	Dir         string
	Env         []string
	Conn        io.ReadWriteCloser
	Scrollback  int
	ImageLimit  int64
	Cursor      terminal.CursorStyle
	CursorBlink bool
	// OnTitle, OnExit and OnBell run as the program sets the title, ends
	// or rings the bell.
	OnTitle func(title string)
	OnExit  func(code int)
	OnBell  func()
	// Unavailable renders when its session cannot start, such as a browser session without Conn, with why.
	Unavailable func(message string) core.Node

	// The view, as terminal.View: Theme and DarkTheme name Ghostty's
	// themes, DarkTheme being Theme when unset.
	Theme, DarkTheme                        func() string
	FontFamily                              func() string
	FontSize                                func() float64
	PaddingX, PaddingY                      func() float64
	AllowClipboardRead, AllowClipboardWrite func() bool
	PaddingColor                            func() terminal.PaddingColor
	MinimumContrast                         func() float64
	AutoFocus                               bool
	Transparent                             bool
	MouseReporting                          func() bool
	MouseScrollPrecision                    func() float64
	MouseScrollDiscrete                     func() float64
	Keybinds                                func() []terminal.Keybind
	RightClickAction                        func() terminal.RightClickAction
	MenuClass                               string
	MenuStyle                               core.Style
	MenuItemClass                           string
	MenuItemStyle                           core.Style
	NoKeyBar                                func() bool
	KeyBarKeys                              []string
	KeyBarClass                             string
	KeyBarStyle                             core.Style
	KeyClass                                string
	KeyStyle                                core.Style
	KeyOnClass                              string
	KeyOnStyle                              core.Style
	OnSizeChange                            func(cols, rows int)
	OnFocus, OnBlur                         func()
	Class, Label, TestID                    string
	Style                                   core.Style
	Ref                                     *Ref
}

Terminal is a terminal running a program, the user's shell by default, or connected to Conn. Its session's props start it, and a change of one starts another; the view's follow their props, the session going on.

func (Terminal) Render

func (p Terminal) Render(cx *core.Scope) core.Node

Render implements core.Node.

Jump to

Keyboard shortcuts

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