Documentation
¶
Overview ¶
Package vt provides a virtual terminal that implements tuist.Terminal backed by midterm.Terminal. It interprets all ANSI escape sequences exactly as a real terminal would — cursor movement, colors, line clearing, synchronized output, etc. — making it ideal for testing, headless rendering, and golden file snapshots.
Index ¶
- type Frame
- type Terminal
- func (m *Terminal) Columns() int
- func (m *Terminal) HideCursor()
- func (m *Terminal) Render() string
- func (m *Terminal) Rows() int
- func (m *Terminal) SetInputPassthrough(io.Writer)
- func (m *Terminal) ShowCursor()
- func (m *Terminal) Start(onInput func([]byte), onResize func()) error
- func (m *Terminal) Stop()
- func (m *Terminal) Write(p []byte)
- func (m *Terminal) WriteString(s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶ added in v0.0.6
type Frame struct {
Number int
Lines []string // all content lines (full output)
Width int // terminal width (0 if not recorded)
Height int // terminal height (viewport)
ViewportTop int
}
Frame holds the parsed content of a single TUIST_FRAMES dump file.
func ParseFrame ¶ added in v0.0.6
ParseFrame parses a single TUIST_FRAMES dump file.
func ParseFrameFile ¶ added in v0.0.6
ParseFrameFile reads and parses a TUIST_FRAMES dump file from disk.
type Terminal ¶
type Terminal struct {
// VT is the underlying virtual terminal. Access it directly to
// inspect content, cursor position, cell formatting, etc.
VT *midterm.Terminal
}
Terminal implements tuist.Terminal backed by a midterm.Terminal. All output from the TUI is interpreted by the virtual terminal, producing a pixel-perfect representation of what a real terminal would display.
func Replay ¶ added in v0.0.6
Replay feeds a sequence of frames through a TUI backed by a virtual terminal, returning the terminal after the last frame. Each frame is rendered via tuist.TUI.RenderOnce.
Width must be provided if the frame files don't include it (pre-width format). Pass 0 to use the width from the frame header.
func (*Terminal) HideCursor ¶
func (m *Terminal) HideCursor()
func (*Terminal) Render ¶
Render returns the virtual terminal's content as a string including ANSI escape sequences for colors and formatting, capturing the full styled appearance as a real terminal would display it.
func (*Terminal) SetInputPassthrough ¶
func (*Terminal) ShowCursor ¶
func (m *Terminal) ShowCursor()