Documentation
¶
Index ¶
- Constants
- type Cell
- type Color
- type EscapeError
- type Grid
- type SGRState
- type Terminal
- func (t *Terminal) AltScreenActive() bool
- func (t *Terminal) Clear()
- func (t *Terminal) CursorPos() (int, int)
- func (t *Terminal) GetHistoryAsAnsi() []byte
- func (t *Terminal) GetModesAsAnsi() []byte
- func (t *Terminal) GetScreenAsAnsi() []byte
- func (t *Terminal) Resize(rows, cols int)
- func (t *Terminal) Write(p []byte) (int, error)
Constants ¶
const ( Color16 = 1 Color256 = 2 Color16M = 3 )
const ( FlagBold uint8 = 1 << iota FlagDim FlagItalic FlagUnderline FlagBlink FlagInverse FlagInvisible FlagStrike )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EscapeError ¶
func (EscapeError) Error ¶
func (e EscapeError) Error() string
type Grid ¶ added in v0.0.18
type Grid struct {
// contains filtered or unexported fields
}
func (*Grid) Resize ¶ added in v0.0.18
Resize regular resize without reflow, it will chomp any extra lines/columns
func (*Grid) ResizeAndReflow ¶ added in v0.0.18
ResizeAndReflow resize the grid and reflow based on newline markers
type SGRState ¶ added in v0.0.15
type Terminal ¶
Terminal is an in memory terminal emulator
func (*Terminal) AltScreenActive ¶ added in v0.0.29
AltScreenActive reports whether the alternate screen is in use.
func (*Terminal) CursorPos ¶ added in v0.0.13
GetCursorPos returns the current cursor position in lines, cols
func (*Terminal) GetHistoryAsAnsi ¶ added in v0.0.28
GetHistoryAsAnsi returns the scrollback backlog — the lines above the visible screen — rendered as ANSI, one \r\n-terminated line per row, ending with an SGR reset so the last line's attributes never bleed into whatever is written next. On the alt screen the whole primary screen counts as history: it is what was on display before the alt-screen app took over.
func (*Terminal) GetModesAsAnsi ¶ added in v0.0.29
GetModesAsAnsi returns the escape sequences that restore terminal state the screen content alone cannot carry. Today that is the DECSTBM scroll region: without it a reconnected viewer scrolls the whole screen where the host (e.g. tmux protecting its status line) scrolls only a region, leaving a stale copy of the protected line behind. Empty when the region is the full screen. DECSTBM homes the cursor, so callers must emit this before the final cursor position.