Documentation
¶
Overview ¶
Package vterm is a minimal in-process VT100/xterm screen emulator. It replaces tmux's pane rendering for the native session backend: the session host feeds raw PTY output into a Terminal, and Capture returns the rendered plain-text tail the way `tmux capture-pane -p -J` used to. It models only what peek/capture needs — a character grid, scrollback history, cursor motion, erase/insert/delete, scroll regions, and the alternate screen. Colors and attributes (SGR) are tracked per cell so Redraw can repaint a re-attaching client faithfully; Capture output stays plain text by contract, exactly like the old capture-pane path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal is a virtual terminal. It is not goroutine-safe; the session host serializes access behind its own lock.
func (*Terminal) Capture ¶
Capture renders the last maxLines lines of the terminal as plain text: scrollback history plus the active screen, with soft-wrapped lines joined (the capture-pane -J contract) and trailing blank lines trimmed. The result ends with a newline when non-empty.
func (*Terminal) FocusReporting ¶
FocusReporting reports whether the agent has focus reporting (DEC private mode 1004) enabled. The session host uses it to synthesize focus events at attach and detach boundaries: a real terminal tells the application when its window gains or loses focus, and an agent running under a detached host would otherwise never hear either.
func (*Terminal) Redraw ¶
Redraw returns an ANSI byte sequence that repaints the current screen on a fresh terminal: reset attributes, clear, draw every row with the SGR state each cell was written with, and park the cursor. The session host sends it to a newly attached client so the user sees the live screen — colors included — immediately.