Documentation ¶
Index ¶
- type CharAttribute
- 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 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) Unhook()
- type RGBColor
- type StandardCharset
- 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 { // 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 StandardCharset) // Dcaln runs the DECALN command. Decaln() // DeleteChars deletes n characters. DeleteChars(n int) // DeleteLines deletes n lines. DeleteLines(n int) // 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() // 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() // SetModifyOtherKeys sets the modify other keys mode. (XTERM) SetModifyOtherKeys(modify ModifyOtherKeys) // SetScrollingRegion sets the scrolling region. SetScrollingRegion(top int, bottom int) // SetTerminalCharAttribute sets the terminal char attribute. SetTerminalCharAttribute(attr TerminalCharAttribute) // SetTitle sets the window title. SetTitle(title string) // Substitue 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() // 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 {
// contains filtered or unexported fields
}
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 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.
type RGBColor ¶
type RGBColor struct {
R, G, B uint8
}
RGBColor is a color that can be represented by RGB values.
type StandardCharset ¶
type StandardCharset int
StandardCharset is used to select a standard charset.
const ( StandardCharsetASCII StandardCharset = iota StandardCharsetSpecialCharacterAndLineDrawing )
StandardCharset values.
func (StandardCharset) Char ¶
func (sc StandardCharset) Char(c rune) rune
Char returns the rune for the given rune in the given charset.
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.