Documentation
¶
Index ¶
- type C0
- type CSI
- type DCS
- type DCSData
- type DCSEndOfData
- type EOF
- type ESC
- type EventBell
- type EventClipboard
- type EventClosed
- type EventMouseMode
- type EventPanic
- type EventRedraw
- type EventTerminal
- type EventTitle
- type OSC
- type Parser
- type Print
- type Sequence
- type Surface
- type Terminal
- type VT
- func (vt *VT) Attach(fn func(ev tcell.Event))
- func (vt *VT) Close()
- func (vt *VT) Cursor() (int, int, tcell.CursorStyle, bool)
- func (vt *VT) Detach()
- func (vt *VT) Draw()
- func (vt *VT) HandleEvent(e tcell.Event) bool
- func (vt *VT) Resize(w int, h int)
- func (vt *VT) SetSurface(srf Surface)
- func (vt *VT) Start(cmd *exec.Cmd) error
- func (vt *VT) StartWithPty(p io.ReadWriteCloser) error
- func (vt *VT) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventClipboard ¶ added in v1.1.0
type EventClipboard struct {
*EventTerminal
// contains filtered or unexported fields
}
EventClipboard is emitted when an OSC 52 clipboard sequence is received
func (*EventClipboard) Data ¶ added in v1.1.0
func (ev *EventClipboard) Data() string
func (*EventClipboard) Selection ¶ added in v1.1.0
func (ev *EventClipboard) Selection() string
type EventClosed ¶
type EventClosed struct {
*EventTerminal
}
EventClosed is emitted when the terminal exits
type EventMouseMode ¶
type EventMouseMode struct {
*EventTerminal
// contains filtered or unexported fields
}
EventMouseMode is emitted when the terminal mouse mode changes
func (*EventMouseMode) Flags ¶
func (ev *EventMouseMode) Flags() []tcell.MouseFlags
type EventPanic ¶
type EventPanic struct {
*EventTerminal
Error error
}
type EventRedraw ¶
type EventRedraw struct {
*EventTerminal
}
EventRedraw is emitted when the terminal requires redrawing
type EventTerminal ¶
type EventTerminal struct {
// contains filtered or unexported fields
}
EventTerminal is a generic terminal event
func (*EventTerminal) VT ¶
func (ev *EventTerminal) VT() *VT
func (*EventTerminal) When ¶
func (ev *EventTerminal) When() time.Time
type EventTitle ¶
type EventTitle struct {
*EventTerminal
// contains filtered or unexported fields
}
EventTitle is emitted when the terminal's title changes
func (*EventTitle) Title ¶
func (ev *EventTitle) Title() string
type OSC ¶
type OSC struct {
Payload []rune
}
An OSC sequence. The Payload is the raw runes received, and must be parsed externally
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
https://vt100.net/emu/dec_ansi_parser
parser is an implementation of Paul Flo Williams' VT500-series parser, as seen [here](https://vt100.net/emu/dec_ansi_parser). The architecture is designed after Rob Pike's text/template parser, with a few modifications.
Many of the comments are directly from Paul Flo Williams description of the parser, licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/)
func (*Parser) Next ¶
Next returns the next Sequence. Sequences will be of the following types:
error Sent on any parsing error Print Print the character to the screen C0 Execute the C0 code ESC Execute the ESC sequence CSI Execute the CSI sequence OSCStart Signals the start of an OSC sequence OSCData Characters from the OSC sequence OSCEnd Signals end of the OSC sequence DCS Signals start of a DCS sequence, and DCS params/intermediates DCSData Raw DCS passthrough data DCSEndOfData Signals end of DCS sequence EOF Sent at end of input
func (*Parser) SetExitFunc ¶ added in v1.1.0
func (p *Parser) SetExitFunc(f func())
SetExitFunc replaces the parser exit callback. It is primarily useful for tests that need to observe exit handling.
type Sequence ¶
type Sequence interface{}
Sequence is the generic data type of items emitted from the parser. These can be control sequences, escape sequences, or printable characters.
type Surface ¶
type Surface interface {
// SetContent is used to update the content of the Surface at the given
// location.
SetContent(x int, y int, ch rune, comb []rune, style tcell.Style)
// Size represents the visible size.
Size() (int, int)
}
Surface represents a logical view on an area. It uses a subset of methods from a tcell.Screen or a views.View, in order to be a more broad implementation. Both a Screen and a View are also a Surface
type Terminal ¶
func NewTerminalFromPty ¶ added in v1.1.0
func NewTerminalFromPty(app *cui.App, p io.ReadWriteCloser) *Terminal
NewTerminalFromPty creates a Terminal widget driven by a pre-opened pty (or any io.ReadWriteCloser). No subprocess is spawned; the caller is responsible for driving the slave side.
func (*Terminal) HandleEvent ¶
func (*Terminal) InputHandler ¶
func (*Terminal) MouseHandler ¶
func (t *Terminal) MouseHandler() func(action cui.MouseAction, event *tcell.EventMouse, setFocus func(p cui.Widget)) (consumed bool, capture cui.Widget)
type VT ¶
type VT struct {
Logger *log.Logger
// If true, OSC8 enables the output of OSC8 strings. Otherwise, any OSC8
// sequences will be stripped
OSC8 bool
// Set the TERM environment variable to be passed to the command's
// environment. If not set, xterm-256color will be used
TERM string
// contains filtered or unexported fields
}
VT models a virtual terminal
func (*VT) SetSurface ¶
func (*VT) Start ¶
Start starts the terminal with the specified command. Start returns when the command has been successfully started.
func (*VT) StartWithPty ¶ added in v1.1.0
func (vt *VT) StartWithPty(p io.ReadWriteCloser) error
StartWithPty starts the terminal using an already-opened pty (or any io.ReadWriteCloser). No subprocess is spawned; the caller is responsible for driving the slave side of the pty. StartWithPty returns immediately.