Documentation
¶
Index ¶
- type CharAttribute
- type Charset
- type CharsetIndex
- type ClearMode
- type CursorStyle
- type Decoder
- type Handler
- type Hyperlink
- type IndexedColor
- type KeyboardMode
- type KeyboardModeBehavior
- type LineClearMode
- type Logger
- type ModifyOtherKeys
- type NamedColor
- type NotificationPayload
- type Performer
- func (p *Performer) CsiDispatch(params [][]uint16, intermediates []byte, ignore bool, action rune)
- func (p *Performer) EscDispatch(intermediates []byte, ignore bool, b byte)
- func (p *Performer) Execute(b byte)
- func (p *Performer) Hook(params [][]uint16, intermediates []byte, ignore bool, r rune)
- func (p *Performer) OscDispatch(params [][]byte, bellTerminated bool)
- func (p *Performer) Print(r rune)
- func (p *Performer) Put(b byte)
- func (p *Performer) SosPmApcDispatch(kind byte, data []byte, bellTerminated bool)
- func (p *Performer) Unhook()
- type RGBColor
- type ShellIntegrationMark
- type TabulationClearMode
- type TerminalCharAttribute
- type TerminalMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharAttribute ¶
type CharAttribute int
CharAttribute is the character attribute.
const ( CharAttributeReset CharAttribute = iota CharAttributeBold CharAttributeDim CharAttributeItalic CharAttributeUnderline CharAttributeDoubleUnderline CharAttributeCurlyUnderline CharAttributeDottedUnderline CharAttributeDashedUnderline CharAttributeBlinkSlow CharAttributeBlinkFast CharAttributeReverse CharAttributeHidden CharAttributeStrike CharAttributeCancelBold CharAttributeCancelBoldDim CharAttributeCancelItalic CharAttributeCancelUnderline CharAttributeCancelBlink CharAttributeCancelReverse CharAttributeCancelHidden CharAttributeCancelStrike CharAttributeForeground CharAttributeBackground CharAttributeUnderlineColor )
CharAttribute values.
type CharsetIndex ¶
type CharsetIndex int
CharsetIndex is used to index into the charset table.
const ( CharsetIndexG0 CharsetIndex = iota CharsetIndexG1 CharsetIndexG2 CharsetIndexG3 )
CharsetIndex values.
type CursorStyle ¶
type CursorStyle int
CursorStyle is the cursor style.
const ( CursorStyleBlinkingBlock CursorStyle = iota CursorStyleSteadyBlock CursorStyleBlinkingUnderline CursorStyleSteadyUnderline CursorStyleBlinkingBar CursorStyleSteadyBar )
CursorStyle values.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is a byte writer that decodes ANSI escape sequences.
type Handler ¶
type Handler interface {
// ApplicationCommandReceived handles Application Program Command (APC) sequences (ESC _ ... ST).
// Used by protocols like Kitty Graphics.
ApplicationCommandReceived(data []byte)
// Backspace moves the cursor one position to the left.
Backspace()
// Bell rings the bell.
Bell()
// CarriageReturn moves the cursor to the beginning of the line.
CarriageReturn()
// ClearLine clears the line.
ClearLine(mode LineClearMode)
// ClearScreen clears the screen.
ClearScreen(mode ClearMode)
// ClearTabs clears the tab stops.
ClearTabs(mode TabulationClearMode)
// ClipboardLoad loads data from the clipboard.
ClipboardLoad(clipboard byte, terminator string)
// ClipboardStore stores data in the clipboard.
ClipboardStore(clipboard byte, data []byte)
// ConfigureCharset configures the charset.
ConfigureCharset(index CharsetIndex, charset Charset)
// Dcaln runs the DECALN command.
Decaln()
// DeleteChars deletes n characters.
DeleteChars(n int)
// DeleteLines deletes n lines.
DeleteLines(n int)
// DesktopNotification handles OSC 99 desktop notifications (Kitty protocol).
// The payload contains all parsed notification data. The provider is responsible
// for handling queries (PayloadType="?") and returning its supported capabilities.
DesktopNotification(payload *NotificationPayload)
// DeviceStatus reports the device status.
DeviceStatus(n int)
// EraseChars erases n characters.
// erase means reset to the default state. (default colors, no content, no flags)
EraseChars(n int)
// Goto moves the cursor to the specified position.
Goto(y int, x int)
// GotoCol moves the cursor to the specified column.
GotoCol(n int)
// GotoLine moves the cursor to the specified line.
GotoLine(n int)
// HorizontalTab sets the current position as a tab stop.
HorizontalTabSet()
// IdentifyTerminal identifies the terminal.
IdentifyTerminal(b byte)
// Input inputs a rune to be displayed.
Input(r rune)
// InsertBlank inserts n blank characters.
InsertBlank(n int)
// InsertBlankLines inserts n blank lines.
InsertBlankLines(n int)
// LineFeed moves the cursor to the next line.
LineFeed()
// MoveBackward moves the cursor backward n columns.
MoveBackward(n int)
// MoveBackwardTabs moves the cursor backward n tab stops.
MoveBackwardTabs(n int)
// MoveDown moves the cursor down n lines.
MoveDown(n int)
// MoveDownCr moves the cursor down n lines and to the beginning of the line.
MoveDownCr(n int)
// MoveForward moves the cursor forward n columns.
MoveForward(n int)
// MoveForwardTabs moves the cursor forward n tab stops.
MoveForwardTabs(n int)
// MoveUp moves the cursor up n lines.
MoveUp(n int)
// MoveUpCr moves the cursor up n lines and to the beginning of the line.
MoveUpCr(n int)
// PopKeyboardMode pops the given amount n of keyboard modes from the stack.
PopKeyboardMode(n int)
// PopTitle pops the title from the stack.
PopTitle()
// PrivacyMessageReceived handles Privacy Message (PM) sequences (ESC ^ ... ST).
PrivacyMessageReceived(data []byte)
// PushKeyboardMode pushes the given keyboard mode to the stack.
PushKeyboardMode(mode KeyboardMode)
// PushTitle pushes the given title to the stack.
PushTitle()
// ReportKeyboardMode reports the keyboard mode.
ReportKeyboardMode()
// ReportModifyOtherKeys reports the modify other keys mode. (XTERM)
ReportModifyOtherKeys()
// ResetColor resets the color at the given index.
ResetColor(i int)
// ResetState resets the termnial state.
ResetState()
// RestoreCursorPosition restores the cursor position.
RestoreCursorPosition()
// ReverseIndex moves the active position to the same horizontal position on the preceding line.
// If the active position is at the top margin, a scroll down is performed.
ReverseIndex()
// SaveCursorPosition saves the cursor position.
SaveCursorPosition()
// ScrollDown scrolls the screen down n lines.
ScrollDown(n int)
// ScrollUp scrolls the screen up n lines.
ScrollUp(n int)
// SetActiveCharset sets the active charset.
SetActiveCharset(n int)
// SetColor sets the color at the given index.
SetColor(index int, color color.Color)
// SetCursorStyle sets the cursor style.
SetCursorStyle(style CursorStyle)
// SetDynamicColor sets the dynamic color at the given index.
SetDynamicColor(prefix string, index int, terminator string)
// SetHyperlink sets the hyperlink.
SetHyperlink(hyperlink *Hyperlink)
// SetKeyboardMode sets the keyboard mode.
SetKeyboardMode(mode KeyboardMode, behavior KeyboardModeBehavior)
// SetKeypadApplicationMode sets keypad to applications mode.
SetKeypadApplicationMode()
// SetMode sets the given mode.
SetMode(mode TerminalMode)
// SetModifyOtherKeys sets the modify other keys mode. (XTERM)
SetModifyOtherKeys(modify ModifyOtherKeys)
// SetScrollingRegion sets the scrolling region.
SetScrollingRegion(top int, bottom int)
// StartOfStringReceived handles Start of String (SOS) sequences (ESC X ... ST).
StartOfStringReceived(data []byte)
// SetTerminalCharAttribute sets the terminal char attribute.
SetTerminalCharAttribute(attr TerminalCharAttribute)
// SetTitle sets the window title.
SetTitle(title string)
// SetWorkingDirectory sets the current working directory (OSC 7).
// uri is in the format "file://hostname/path/to/dir".
SetWorkingDirectory(uri string)
// SetUserVar sets a user variable (OSC 1337 SetUserVar).
// name is the variable name, value is the decoded variable value.
// Used by iTerm2/WezTerm shell integration to pass metadata.
SetUserVar(name, value string)
// ShellIntegrationMark handles shell integration marks (OSC 133).
// mark indicates the type of mark (PromptStart, CommandStart, CommandExecuted, CommandFinished).
// exitCode is only valid for CommandFinished marks (-1 if not provided).
ShellIntegrationMark(mark ShellIntegrationMark, exitCode int)
// SixelReceived is called when a complete Sixel image sequence is received.
// params contains the DCS parameters before 'q' (e.g., aspect ratio settings).
// data contains the Sixel image data.
SixelReceived(params [][]uint16, data []byte)
// Substitute replaces the character under the cursor.
Substitute()
// Tab moves the cursor to the next tab stop.
Tab(n int)
// TextAreaSizeChars reports the text area size in characters.
TextAreaSizeChars()
// TextAreaSizePixels reports the text area size in pixels.
TextAreaSizePixels()
// CellSizePixels reports the cell size in pixels.
CellSizePixels()
// UnsetKeypadApplicationMode sets the keypad to numeric mode.
UnsetKeypadApplicationMode()
// UnsetMode unsets the given mode.
UnsetMode(mode TerminalMode)
}
Handler is the interface that handles ANSI escape sequences.
type Hyperlink ¶
type Hyperlink struct {
// ID is the hyperlink ID.
ID string
// URI is the hyperlink URI.
URI string
}
Hyperlink is used to represent a hyperlink.
type IndexedColor ¶
type IndexedColor struct {
Index byte
}
IndexedColor is a color that can be represented by an index.
type KeyboardMode ¶
type KeyboardMode byte
KeyboardMode is the keyboard mode.
const ( KeyboardModeNoMode KeyboardMode = 0b0000_0000 KeyboardModeDisambiguateEscCodes KeyboardMode = 0b0000_0001 KeyboardModeReportEventTypes KeyboardMode = 0b0000_0010 KeyboardModeReportAlternateKeys KeyboardMode = 0b0000_0100 KeyboardModeReportAllKeysAsEsc KeyboardMode = 0b0000_1000 KeyboardModeReportAssociatedText KeyboardMode = 0b0001_0000 )
KeyboardMode values.
type KeyboardModeBehavior ¶
type KeyboardModeBehavior int
KeyboardModeBehavior is the keyboard mode behavior.
const ( KeyboardModeBehaviorReplace KeyboardModeBehavior = iota KeyboardModeBehaviorUnion KeyboardModeBehaviorDifference )
KeyboardModeBehavior values.
type LineClearMode ¶
type LineClearMode int
LineClearMode is the line clear mode.
const ( LineClearModeRight LineClearMode = iota LineClearModeLeft LineClearModeAll )
LineClearMode values.
type ModifyOtherKeys ¶
type ModifyOtherKeys int
ModifyOtherKeys is the XTerm modify other keys mode.
const ( ModifyOtherKeysReset ModifyOtherKeys = iota ModifyOtherKeysEnableExceptWellDefined ModifyOtherKeysResetEnableAll )
ModifyOtherKeys values.
type NamedColor ¶
type NamedColor int
NamedColor is a color that can be referenced by name.
const ( NamedColorBlack NamedColor = 0 NamedColorRed NamedColor = 1 NamedColorGreen NamedColor = 2 NamedColorYellow NamedColor = 3 NamedColorBlue NamedColor = 4 NamedColorMagenta NamedColor = 5 NamedColorCyan NamedColor = 6 NamedColorWhite NamedColor = 7 NamedColorBrightBlack NamedColor = 8 NamedColorBrightRed NamedColor = 9 NamedColorBrightGreen NamedColor = 10 NamedColorBrightYellow NamedColor = 11 NamedColorBrightBlue NamedColor = 12 NamedColorBrightMagenta NamedColor = 13 NamedColorBrightCyan NamedColor = 14 NamedColorBrightWhite NamedColor = 15 NamedColorCubeStart NamedColor = 16 NamedColorCubeEnd NamedColor = 232 NamedColorGrayscaleStart NamedColor = 233 NamedColorGrayscaleEnd NamedColor = 255 NamedColorForeground NamedColor = 256 NamedColorBackground NamedColor = 257 NamedColorCursor NamedColor = 258 NamedColorDimBlack NamedColor = 259 NamedColorDimRed NamedColor = 260 NamedColorDimGreen NamedColor = 261 NamedColorDimYellow NamedColor = 262 NamedColorDimBlue NamedColor = 263 NamedColorDimMagenta NamedColor = 264 NamedColorDimCyan NamedColor = 265 NamedColorDimWhite NamedColor = 266 NamedColorBrightForeground NamedColor = 267 NamedColorDimForeground NamedColor = 268 )
NamedColor values.
func (NamedColor) ToBright ¶
func (c NamedColor) ToBright() NamedColor
ToBright returns the bright version of the color.
func (NamedColor) ToDim ¶
func (c NamedColor) ToDim() NamedColor
ToDim returns the dim version of the color.
type NotificationPayload ¶ added in v1.0.13
type NotificationPayload struct {
// ID is the unique identifier for chunking and tracking notifications.
ID string
// Done indicates if this is the final chunk (default true).
Done bool
// PayloadType specifies what kind of data is in Data.
// Values: "title", "body", "icon", "buttons", "close", "alive", "?" (query).
PayloadType string
// Encoding specifies the payload encoding ("1" = base64).
Encoding string
// Actions specifies click behavior: "focus", "report".
Actions []string
// TrackClose indicates if close events should be reported.
TrackClose bool
// Timeout is auto-expiry in milliseconds (-1 = OS default, 0 = never).
Timeout int
// AppName is the application name.
AppName string
// Type is the notification type for filtering.
Type string
// IconName is a standard icon: "error", "warning", "info", "question".
IconName string
// IconCacheID is a UUID for caching custom icons.
IconCacheID string
// Sound is the notification sound: "system", "silent", "error", "warn", "info".
Sound string
// Urgency is 0 (low), 1 (normal), or 2 (critical).
Urgency int
// Occasion is when to show: "always", "unfocused", "invisible".
Occasion string
// Data is the payload content (decoded if base64).
Data []byte
}
NotificationPayload represents a desktop notification from OSC 99 (Kitty protocol). See: https://sw.kovidgoyal.net/kitty/desktop-notifications/
type Performer ¶
type Performer struct {
// contains filtered or unexported fields
}
Performer is a interface for handling ANSI escape sequences.
func NewPerformer ¶
newPerformer creates a new Performer.
func (*Performer) CsiDispatch ¶
CsiDispatch is used to handle csi operations.
func (*Performer) EscDispatch ¶
EscDispatch is used to handle esc operations.
func (*Performer) OscDispatch ¶
OscDispatch is used to handle osc operations.
func (*Performer) SosPmApcDispatch ¶ added in v1.0.10
SosPmApcDispatch is called when a SOS/PM/APC sequence is complete.
type RGBColor ¶
type RGBColor struct {
R, G, B uint8
}
RGBColor is a color that can be represented by RGB values.
type ShellIntegrationMark ¶ added in v1.0.12
type ShellIntegrationMark int
ShellIntegrationMark represents a shell integration mark type (OSC 133).
const ( // PromptStart marks the beginning of the shell prompt (OSC 133 ; A). PromptStart ShellIntegrationMark = iota // CommandStart marks the end of prompt/start of user input (OSC 133 ; B). CommandStart // CommandExecuted marks when command execution begins (OSC 133 ; C). CommandExecuted // CommandFinished marks when command execution ends (OSC 133 ; D). CommandFinished )
type TabulationClearMode ¶
type TabulationClearMode int
TabulationClearMode is the tabulation clear mode.
const ( TabulationClearModeCurrent TabulationClearMode = iota TabulationClearModeAll )
TabulationClearMode values.
type TerminalCharAttribute ¶
type TerminalCharAttribute struct {
Attr CharAttribute
NamedColor *NamedColor
RGBColor *RGBColor
IndexedColor *IndexedColor
}
TerminalCharAttribute is the terminal character attribute.
type TerminalMode ¶
type TerminalMode int
TerminalMode is the terminal mode.
const ( TerminalModeCursorKeys TerminalMode = 1 TerminalModeColumnMode TerminalMode = 3 TerminalModeInsert TerminalMode = 4 TerminalModeOrigin TerminalMode = 6 TerminalModeLineWrap TerminalMode = 7 TerminalModeBlinkingCursor TerminalMode = 12 TerminalModeLineFeedNewLine TerminalMode = 20 TerminalModeShowCursor TerminalMode = 25 TerminalModeReportMouseClicks TerminalMode = 1000 TerminalModeReportCellMouseMotion TerminalMode = 1002 TerminalModeReportAllMouseMotion TerminalMode = 1003 TerminalModeReportFocusInOut TerminalMode = 1004 TerminalModeUTF8Mouse TerminalMode = 1005 TerminalModeSGRMouse TerminalMode = 1006 TerminalModeAlternateScroll TerminalMode = 1007 TerminalModeUrgencyHints TerminalMode = 1042 TerminalModeSwapScreenAndSetRestoreCursor TerminalMode = 1049 TerminalModeBracketedPaste TerminalMode = 2004 )
TerminalMode values.