Documentation
¶
Overview ¶
Package ansi defines common ANSI escape sequences based on the ECMA-48 specs.
All sequences use 7-bit C1 control codes, which are supported by most terminal emulators. OSC sequences are terminated by a BEL for wider compatibility with terminals.
Index ¶
- Constants
- func CBT(n int) string
- func CHA(col int) string
- func CHT(n int) string
- func CNL(n int) string
- func CPL(n int) string
- func CPR(line, column int) string
- func CUB(n int) string
- func CUD(n int) string
- func CUF(n int) string
- func CUP(col, row int) string
- func CUU(n int) string
- func CursorBackward(n int) string
- func CursorBackwardTab(n int) string
- func CursorDown(n int) string
- func CursorForward(n int) string
- func CursorHorizontalAbsolute(col int) string
- func CursorHorizontalForwardTab(n int) string
- func CursorInformationReport(values ...int) string
- func CursorLeft(n int) string
- func CursorNextLine(n int) string
- func CursorPosition(col, row int) string
- func CursorPositionReport(line, column int) string
- func CursorPreviousLine(n int) string
- func CursorRight(n int) string
- func CursorUp(n int) string
- func DA1(attrs ...int) string
- func DA2(attrs ...int) string
- func DA3(unitID string) string
- func DCH(n int) string
- func DECCIR(values ...int) string
- func DECRPM(mode Mode, value ModeSetting) string
- func DECRQM(m Mode) string
- func DECRQPSR(n int) string
- func DECSCUSR(style int) string
- func DECSLRM(left, right int) string
- func DECSTBM(top, bot int) string
- func DECTABSR(stops ...int) string
- func DECXCPR(line, column, page int) string
- func DL(n int) string
- func DSR(status Status) string
- func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width int, n int, newState byte)
- func DeleteCharacter(n int) string
- func DeleteLine(n int) string
- func DeviceStatusReport(statues ...Status) string
- func ECH(n int) string
- func ED(n int) string
- func EL(n int) string
- func Equal[T string | []byte](a, b T) bool
- func EraseCharacter(n int) string
- func EraseDisplay(n int) string
- func EraseLine(n int) string
- func Execute(w io.Writer, s string) (int, error)
- func ExtendedCursorPositionReport(line, column, page int) string
- func FirstGraphemeCluster[T string | []byte](b T, state int) (T, T, int, int)
- func HPA(col int) string
- func HPR(n int) string
- func HVP(col, row int) string
- func Hardwrap(s string, limit int, preserveSpace bool) string
- func HasApcPrefix[T string | []byte](b T) bool
- func HasCsiPrefix[T string | []byte](b T) bool
- func HasDcsPrefix[T string | []byte](b T) bool
- func HasEscPrefix[T string | []byte](b T) bool
- func HasOscPrefix[T string | []byte](b T) bool
- func HasPmPrefix[T string | []byte](b T) bool
- func HasPrefix[T string | []byte](b, prefix T) bool
- func HasSosPrefix[T string | []byte](b T) bool
- func HasStPrefix[T string | []byte](b T) bool
- func HasSuffix[T string | []byte](b, suffix T) bool
- func HorizontalPositionAbsolute(col int) string
- func HorizontalPositionRelative(n int) string
- func HorizontalVerticalPosition(col, row int) string
- func ICH(n int) string
- func IL(n int) string
- func InsertCharacter(n int) string
- func InsertLine(n int) string
- func KeyModifierOptions(p int, vs ...int) string
- func KittyKeyboard(flags, mode int) string
- func ModifyOtherKeys(mode int) string
- func MouseSgr(b byte, x, y int, release bool) string
- func MouseX10(b byte, x, y int) string
- func MoveCursor(col, row int) stringdeprecated
- func Notify(s string) string
- func PanDown(n int) string
- func PanUp(n int) string
- func Params(p []byte) [][]uint
- func PopKittyKeyboard(n int) string
- func PrimaryDeviceAttributes(attrs ...int) string
- func PushKittyKeyboard(flags int) string
- func PutParser(p *Parser)
- func QueryKeyModifierOptions(pp int) string
- func REP(n int) string
- func RM(modes ...Mode) string
- func RepeatPreviousCharacter(n int) string
- func ReportMode(mode Mode, value ModeSetting) string
- func RequestClipboard(c byte) string
- func RequestMode(m Mode) string
- func RequestPresentationStateReport(n int) string
- func RequestTermcap(caps ...string) string
- func RequestTerminfo(caps ...string) string
- func ResetClipboard(c byte) string
- func ResetHyperlink(params ...string) string
- func ResetKeyModifierOptions(pp int) string
- func ResetMode(modes ...Mode) string
- func SCS(gset byte, charset byte) string
- func SD(n int) string
- func SGR(ps ...Attr) string
- func SM(modes ...Mode) string
- func SU(n int) string
- func ScreenPassthrough(seq string, limit int) string
- func ScrollDown(n int) string
- func ScrollUp(n int) string
- func SecondaryDeviceAttributes(attrs ...int) string
- func SelectCharacterSet(gset byte, charset byte) string
- func SelectGraphicRendition(ps ...Attr) string
- func SetBackgroundColor(c color.Color) string
- func SetClipboard(c byte, d string) string
- func SetCursorColor(c color.Color) string
- func SetCursorPosition(col, row int) string
- func SetCursorStyle(style int) string
- func SetForegroundColor(c color.Color) string
- func SetHyperlink(uri string, params ...string) string
- func SetIconName(s string) string
- func SetIconNameWindowTitle(s string) string
- func SetKeyModifierOptions(pp int, pv int) string
- func SetLeftRightMargins(left, right int) string
- func SetMode(modes ...Mode) string
- func SetPointerShape(shape string) string
- func SetPrimaryClipboard(d string) string
- func SetScrollingRegion(t, b int) string
- func SetSystemClipboard(d string) string
- func SetTopBottomMargins(top, bot int) string
- func SetWindowTitle(s string) string
- func StringWidth(s string) int
- func Strip(s string) string
- func TBC(n int) string
- func TabClear(n int) string
- func TabStopReport(stops ...int) string
- func TertiaryDeviceAttributes(unitID string) string
- func TmuxPassthrough(seq string) string
- func Truncate(s string, length int, tail string) string
- func VPA(row int) string
- func VPR(n int) string
- func VerticalPositionAbsolute(row int) string
- func VerticalPositionRelative(n int) string
- func Wordwrap(s string, limit int, breakpoints string) string
- func Wrap(s string, limit int, breakpoints string) string
- func XTGETTCAP(caps ...string) string
- func XTMODKEYS(p int, vs ...int) string
- func XTQMODKEYS(pp int) string
- type ANSIMode
- type ANSIStatus
- type ApcSequence
- type Attr
- type BasicColor
- type Color
- type Colorizer
- type Command
- type ControlCode
- type CsiSequence
- type DECMode
- type DECStatus
- type DcsSequence
- func (s DcsSequence) Bytes() []byte
- func (s DcsSequence) Clone() Sequence
- func (s DcsSequence) Command() int
- func (s DcsSequence) Intermediate() int
- func (s DcsSequence) Marker() int
- func (s DcsSequence) Param(i, def int) (int, bool)
- func (s DcsSequence) Split() []string
- func (s DcsSequence) String() string
- type EscSequence
- type ExtendedColor
- type Grapheme
- type HexColorizer
- type Mode
- type ModeSetting
- type OscSequence
- type Parameter
- type Parser
- func (p *Parser) Advance(b byte) parser.Action
- func (p *Parser) Cmd() Command
- func (p *Parser) Data() []byte
- func (p *Parser) Param(i, def int) (int, bool)
- func (p *Parser) Params() []Parameter
- func (p *Parser) Parse(b []byte)
- func (p *Parser) Reset()
- func (p *Parser) Rune() rune
- func (p *Parser) SetDataSize(size int)
- func (p *Parser) SetDispatcher(d ParserDispatcher)
- func (p *Parser) SetParamsSize(size int)
- func (p *Parser) State() parser.State
- func (p *Parser) StateName() string
- type ParserDispatcher
- type PmSequence
- type Rune
- type Sequence
- type SosSequence
- type State
- type Status
- type Style
- func (s Style) BackgroundColor(c Color) Style
- func (s Style) Bold() Style
- func (s Style) Conceal() Style
- func (s Style) CurlyUnderline() Style
- func (s Style) DashedUnderline() Style
- func (s Style) DefaultBackgroundColor() Style
- func (s Style) DefaultForegroundColor() Style
- func (s Style) DefaultUnderlineColor() Style
- func (s Style) DottedUnderline() Style
- func (s Style) DoubleUnderline() Style
- func (s Style) Faint() Style
- func (s Style) ForegroundColor(c Color) Style
- func (s Style) Italic() Style
- func (s Style) NoBlink() Style
- func (s Style) NoBold() Style
- func (s Style) NoConceal() Style
- func (s Style) NoItalic() Style
- func (s Style) NoReverse() Style
- func (s Style) NoStrikethrough() Style
- func (s Style) NoUnderline() Style
- func (s Style) NormalIntensity() Style
- func (s Style) RapidBlink() Style
- func (s Style) Reset() Style
- func (s Style) Reverse() Style
- func (s Style) SlowBlink() Style
- func (s Style) Strikethrough() Style
- func (s Style) String() string
- func (s Style) Styled(str string) string
- func (s Style) Underline() Style
- func (s Style) UnderlineColor(c Color) Style
- func (s Style) UnderlineStyle(u UnderlineStyle) Style
- type TrueColor
- type UnderlineStyle
- type XRGBAColorizer
- type XRGBColorizer
Constants ¶
const ( // SP is the space character (Char: \x20). SP = 0x20 // DEL is the delete character (Caret: ^?, Char: \x7f). DEL = 0x7F )
const ( // NUL is the null character (Caret: ^@, Char: \0). NUL = 0x00 // SOH is the start of heading character (Caret: ^A). SOH = 0x01 // STX is the start of text character (Caret: ^B). STX = 0x02 // ETX is the end of text character (Caret: ^C). ETX = 0x03 // EOT is the end of transmission character (Caret: ^D). EOT = 0x04 // ENQ is the enquiry character (Caret: ^E). ENQ = 0x05 // ACK is the acknowledge character (Caret: ^F). ACK = 0x06 // BEL is the bell character (Caret: ^G, Char: \a). BEL = 0x07 // BS is the backspace character (Caret: ^H, Char: \b). BS = 0x08 // HT is the horizontal tab character (Caret: ^I, Char: \t). HT = 0x09 // LF is the line feed character (Caret: ^J, Char: \n). LF = 0x0A // VT is the vertical tab character (Caret: ^K, Char: \v). VT = 0x0B // FF is the form feed character (Caret: ^L, Char: \f). FF = 0x0C // CR is the carriage return character (Caret: ^M, Char: \r). CR = 0x0D // SO is the shift out character (Caret: ^N). SO = 0x0E // SI is the shift in character (Caret: ^O). SI = 0x0F // DLE is the data link escape character (Caret: ^P). DLE = 0x10 // DC1 is the device control 1 character (Caret: ^Q). DC1 = 0x11 // DC2 is the device control 2 character (Caret: ^R). DC2 = 0x12 // DC3 is the device control 3 character (Caret: ^S). DC3 = 0x13 // DC4 is the device control 4 character (Caret: ^T). DC4 = 0x14 // NAK is the negative acknowledge character (Caret: ^U). NAK = 0x15 // SYN is the synchronous idle character (Caret: ^V). SYN = 0x16 // ETB is the end of transmission block character (Caret: ^W). ETB = 0x17 // CAN is the cancel character (Caret: ^X). CAN = 0x18 // EM is the end of medium character (Caret: ^Y). EM = 0x19 // SUB is the substitute character (Caret: ^Z). SUB = 0x1A // ESC is the escape character (Caret: ^[, Char: \e). ESC = 0x1B // FS is the file separator character (Caret: ^\). FS = 0x1C // GS is the group separator character (Caret: ^]). GS = 0x1D // RS is the record separator character (Caret: ^^). RS = 0x1E // US is the unit separator character (Caret: ^_). US = 0x1F // LS0 is the locking shift 0 character. // This is an alias for [SI]. LS0 = SI // LS1 is the locking shift 1 character. // This is an alias for [SO]. LS1 = SO )
C0 control characters.
These range from (0x00-0x1F) as defined in ISO 646 (ASCII). See: https://en.wikipedia.org/wiki/C0_and_C1_control_codes
const ( // PAD is the padding character. PAD = 0x80 // HOP is the high octet preset character. HOP = 0x81 // BPH is the break permitted here character. BPH = 0x82 // NBH is the no break here character. NBH = 0x83 // IND is the index character. IND = 0x84 // NEL is the next line character. NEL = 0x85 // SSA is the start of selected area character. SSA = 0x86 // ESA is the end of selected area character. ESA = 0x87 // HTS is the horizontal tab set character. HTS = 0x88 // HTJ is the horizontal tab with justification character. HTJ = 0x89 // VTS is the vertical tab set character. VTS = 0x8A // PLD is the partial line forward character. PLD = 0x8B // PLU is the partial line backward character. PLU = 0x8C // RI is the reverse index character. RI = 0x8D // SS2 is the single shift 2 character. SS2 = 0x8E // SS3 is the single shift 3 character. SS3 = 0x8F // DCS is the device control string character. DCS = 0x90 // PU1 is the private use 1 character. PU1 = 0x91 // PU2 is the private use 2 character. PU2 = 0x92 // STS is the set transmit state character. STS = 0x93 // CCH is the cancel character. CCH = 0x94 // MW is the message waiting character. MW = 0x95 // SPA is the start of guarded area character. SPA = 0x96 // EPA is the end of guarded area character. EPA = 0x97 // SOS is the start of string character. SOS = 0x98 // SGCI is the single graphic character introducer character. SGCI = 0x99 // SCI is the single character introducer character. SCI = 0x9A // CSI is the control sequence introducer character. CSI = 0x9B // ST is the string terminator character. ST = 0x9C // OSC is the operating system command character. OSC = 0x9D // PM is the privacy message character. PM = 0x9E // APC is the application program command character. APC = 0x9F )
C1 control characters.
These range from (0x80-0x9F) as defined in ISO 6429 (ECMA-48). See: https://en.wikipedia.org/wiki/C0_and_C1_control_codes
const ( SystemClipboard = 'c' PrimaryClipboard = 'p' )
Clipboard names.
const ( RequestNameVersion = "\x1b[>0q" XTVERSION = RequestNameVersion )
RequestNameVersion (XTVERSION) is a control sequence that requests the terminal's name and version. It responds with a DSR sequence identifying the terminal.
CSI > 0 q DCS > | text ST
See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys
const ( SaveCursor = "\x1b7" DECSC = SaveCursor )
SaveCursor (DECSC) is an escape sequence that saves the current cursor position.
ESC 7
See: https://vt100.net/docs/vt510-rm/DECSC.html
const ( RestoreCursor = "\x1b8" DECRC = RestoreCursor )
RestoreCursor (DECRC) is an escape sequence that restores the cursor position.
ESC 8
See: https://vt100.net/docs/vt510-rm/DECRC.html
const ( SaveCurrentCursorPosition = "\x1b[s" SCOSC = SaveCurrentCursorPosition )
SaveCurrentCursorPosition (SCOSC) is a sequence for saving the current cursor position for SCO console mode.
CSI s
This acts like DECSC, except the page number where the cursor is located is not saved.
See: https://vt100.net/docs/vt510-rm/SCOSC.html
const ( RestoreCurrentCursorPosition = "\x1b[u" SCORC = RestoreCurrentCursorPosition )
RestoreCurrentCursorPosition (SCORC) is a sequence for restoring the current cursor position for SCO console mode.
CSI u
This acts like DECRC, except the page number where the cursor was saved is not restored.
See: https://vt100.net/docs/vt510-rm/SCORC.html
const ( KeypadApplicationMode = "\x1b=" DECKPAM = KeypadApplicationMode )
Keypad Application Mode (DECKPAM) is a mode that determines whether the keypad sends application sequences or ANSI sequences.
This works like enabling DECNKM. Use NumericKeypadMode to set the numeric keypad mode.
ESC =
See: https://vt100.net/docs/vt510-rm/DECKPAM.html
const ( KeypadNumericMode = "\x1b>" DECKPNM = KeypadNumericMode )
Keypad Numeric Mode (DECKPNM) is a mode that determines whether the keypad sends application sequences or ANSI sequences.
This works the same as disabling DECNKM.
ESC >
See: https://vt100.net/docs/vt510-rm/DECKPNM.html
const ( KittyDisambiguateEscapeCodes = 1 << iota KittyReportEventTypes KittyReportAlternateKeys KittyReportAllKeysAsEscapeCodes KittyReportAssociatedKeys KittyAllFlags = KittyDisambiguateEscapeCodes | KittyReportEventTypes | KittyReportAlternateKeys | KittyReportAllKeysAsEscapeCodes | KittyReportAssociatedKeys )
Kitty keyboard protocol progressive enhancement flags. See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
const ( KeyboardActionMode = ANSIMode(2) KAM = KeyboardActionMode SetKeyboardActionMode = "\x1b[2h" ResetKeyboardActionMode = "\x1b[2l" RequestKeyboardActionMode = "\x1b[2$p" )
Keyboard Action Mode (KAM) is a mode that controls locking of the keyboard. When the keyboard is locked, it cannot send data to the terminal.
See: https://vt100.net/docs/vt510-rm/KAM.html
const ( InsertReplaceMode = ANSIMode(4) IRM = InsertReplaceMode SetInsertReplaceMode = "\x1b[4h" ResetInsertReplaceMode = "\x1b[4l" RequestInsertReplaceMode = "\x1b[4$p" )
Insert/Replace Mode (IRM) is a mode that determines whether characters are inserted or replaced when typed.
When enabled, characters are inserted at the cursor position pushing the characters to the right. When disabled, characters replace the character at the cursor position.
See: https://vt100.net/docs/vt510-rm/IRM.html
const ( SendReceiveMode = ANSIMode(12) LocalEchoMode = SendReceiveMode SRM = SendReceiveMode SetSendReceiveMode = "\x1b[12h" ResetSendReceiveMode = "\x1b[12l" RequestSendReceiveMode = "\x1b[12$p" SetLocalEchoMode = "\x1b[12h" ResetLocalEchoMode = "\x1b[12l" RequestLocalEchoMode = "\x1b[12$p" )
Send Receive Mode (SRM) or Local Echo Mode is a mode that determines whether the terminal echoes characters back to the host. When enabled, the terminal sends characters to the host as they are typed.
See: https://vt100.net/docs/vt510-rm/SRM.html
const ( LineFeedNewLineMode = ANSIMode(20) LNM = LineFeedNewLineMode SetLineFeedNewLineMode = "\x1b[20h" ResetLineFeedNewLineMode = "\x1b[20l" RequestLineFeedNewLineMode = "\x1b[20$p" )
Line Feed/New Line Mode (LNM) is a mode that determines whether the terminal interprets the line feed character as a new line.
When enabled, the terminal interprets the line feed character as a new line. When disabled, the terminal interprets the line feed character as a line feed.
A new line moves the cursor to the first position of the next line. A line feed moves the cursor down one line without changing the column scrolling the screen if necessary.
See: https://vt100.net/docs/vt510-rm/LNM.html
const ( CursorKeysMode = DECMode(1) DECCKM = CursorKeysMode SetCursorKeysMode = "\x1b[?1h" ResetCursorKeysMode = "\x1b[?1l" RequestCursorKeysMode = "\x1b[?1$p" )
Cursor Keys Mode (DECCKM) is a mode that determines whether the cursor keys send ANSI cursor sequences or application sequences.
See: https://vt100.net/docs/vt510-rm/DECCKM.html
const ( EnableCursorKeys = "\x1b[?1h" DisableCursorKeys = "\x1b[?1l" )
Deprecated: use SetCursorKeysMode and ResetCursorKeysMode instead.
const ( OriginMode = DECMode(6) DECOM = OriginMode SetOriginMode = "\x1b[?6h" ResetOriginMode = "\x1b[?6l" RequestOriginMode = "\x1b[?6$p" )
Origin Mode (DECOM) is a mode that determines whether the cursor moves to the home position or the margin position.
See: https://vt100.net/docs/vt510-rm/DECOM.html
const ( AutoWrapMode = DECMode(7) DECAWM = AutoWrapMode SetAutoWrapMode = "\x1b[?7h" ResetAutoWrapMode = "\x1b[?7l" RequestAutoWrapMode = "\x1b[?7$p" )
Auto Wrap Mode (DECAWM) is a mode that determines whether the cursor wraps to the next line when it reaches the right margin.
See: https://vt100.net/docs/vt510-rm/DECAWM.html
const ( X10MouseMode = DECMode(9) SetX10MouseMode = "\x1b[?9h" ResetX10MouseMode = "\x1b[?9l" RequestX10MouseMode = "\x1b[?9$p" )
X10 Mouse Mode is a mode that determines whether the mouse reports on button presses.
The terminal responds with the following encoding:
CSI M CbCxCy
Where Cb is the button-1, where it can be 1, 2, or 3. Cx and Cy are the x and y coordinates of the mouse event.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( TextCursorEnableMode = DECMode(25) DECTCEM = TextCursorEnableMode SetTextCursorEnableMode = "\x1b[?25h" ResetTextCursorEnableMode = "\x1b[?25l" RequestTextCursorEnableMode = "\x1b[?25$p" )
Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor.
See: https://vt100.net/docs/vt510-rm/DECTCEM.html
const ( ShowCursor = SetTextCursorEnableMode HideCursor = ResetTextCursorEnableMode )
These are aliases for SetTextCursorEnableMode and ResetTextCursorEnableMode.
const ( CursorEnableMode = DECMode(25) RequestCursorVisibility = "\x1b[?25$p" )
Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor.
See: https://vt100.net/docs/vt510-rm/DECTCEM.html
Deprecated: use SetTextCursorEnableMode and ResetTextCursorEnableMode instead.
const ( NumericKeypadMode = DECMode(66) DECNKM = NumericKeypadMode SetNumericKeypadMode = "\x1b[?66h" ResetNumericKeypadMode = "\x1b[?66l" RequestNumericKeypadMode = "\x1b[?66$p" )
Numeric Keypad Mode (DECNKM) is a mode that determines whether the keypad sends application sequences or numeric sequences.
This works like DECKPAM and DECKPNM, but uses different sequences.
See: https://vt100.net/docs/vt510-rm/DECNKM.html
const ( BackarrowKeyMode = DECMode(67) DECBKM = BackarrowKeyMode SetBackarrowKeyMode = "\x1b[?67h" ResetBackarrowKeyMode = "\x1b[?67l" RequestBackarrowKeyMode = "\x1b[?67$p" )
Backarrow Key Mode (DECBKM) is a mode that determines whether the backspace key sends a backspace or delete character. Disabled by default.
See: https://vt100.net/docs/vt510-rm/DECBKM.html
const ( LeftRightMarginMode = DECMode(69) DECLRMM = LeftRightMarginMode SetLeftRightMarginMode = "\x1b[?69h" ResetLeftRightMarginMode = "\x1b[?69l" RequestLeftRightMarginMode = "\x1b[?69$p" )
Left Right Margin Mode (DECLRMM) is a mode that determines whether the left and right margins can be set with DECSLRM.
See: https://vt100.net/docs/vt510-rm/DECLRMM.html
const ( NormalMouseMode = DECMode(1000) SetNormalMouseMode = "\x1b[?1000h" ResetNormalMouseMode = "\x1b[?1000l" RequestNormalMouseMode = "\x1b[?1000$p" )
Normal Mouse Mode is a mode that determines whether the mouse reports on button presses and releases. It will also report modifier keys, wheel events, and extra buttons.
It uses the same encoding as X10MouseMode with a few differences:
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( MouseMode = DECMode(1000) EnableMouse = "\x1b[?1000h" DisableMouse = "\x1b[?1000l" RequestMouse = "\x1b[?1000$p" )
VT Mouse Tracking is a mode that determines whether the mouse reports on button press and release.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
Deprecated: use NormalMouseMode instead.
const ( HighlightMouseMode = DECMode(1001) SetHighlightMouseMode = "\x1b[?1001h" ResetHighlightMouseMode = "\x1b[?1001l" RequestHighlightMouseMode = "\x1b[?1001$p" )
Highlight Mouse Tracking is a mode that determines whether the mouse reports on button presses, releases, and highlighted cells.
It uses the same encoding as NormalMouseMode with a few differences:
On highlight events, the terminal responds with the following encoding:
CSI t CxCy CSI T CxCyCxCyCxCy
Where the parameters are startx, starty, endx, endy, mousex, and mousey.
const ( MouseHiliteMode = DECMode(1001) EnableMouseHilite = "\x1b[?1001h" DisableMouseHilite = "\x1b[?1001l" RequestMouseHilite = "\x1b[?1001$p" )
VT Hilite Mouse Tracking is a mode that determines whether the mouse reports on button presses, releases, and highlighted cells.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
Deprecated: use HighlightMouseMode instead.
const ( ButtonEventMouseMode = DECMode(1002) SetButtonEventMouseMode = "\x1b[?1002h" ResetButtonEventMouseMode = "\x1b[?1002l" RequestButtonEventMouseMode = "\x1b[?1002$p" )
Button Event Mouse Tracking is essentially the same as NormalMouseMode, but it also reports button-motion events when a button is pressed.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( MouseCellMotionMode = DECMode(1002) EnableMouseCellMotion = "\x1b[?1002h" DisableMouseCellMotion = "\x1b[?1002l" RequestMouseCellMotion = "\x1b[?1002$p" )
Cell Motion Mouse Tracking is a mode that determines whether the mouse reports on button press, release, and motion events.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
Deprecated: use ButtonEventMouseMode instead.
const ( AnyEventMouseMode = DECMode(1003) SetAnyEventMouseMode = "\x1b[?1003h" ResetAnyEventMouseMode = "\x1b[?1003l" RequestAnyEventMouseMode = "\x1b[?1003$p" )
Any Event Mouse Tracking is the same as ButtonEventMouseMode, except that all motion events are reported even if no mouse buttons are pressed.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( MouseAllMotionMode = DECMode(1003) EnableMouseAllMotion = "\x1b[?1003h" DisableMouseAllMotion = "\x1b[?1003l" RequestMouseAllMotion = "\x1b[?1003$p" )
All Mouse Tracking is a mode that determines whether the mouse reports on button press, release, motion, and highlight events.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
Deprecated: use AnyEventMouseMode instead.
const ( FocusEventMode = DECMode(1004) SetFocusEventMode = "\x1b[?1004h" ResetFocusEventMode = "\x1b[?1004l" RequestFocusEventMode = "\x1b[?1004$p" )
Focus Event Mode is a mode that determines whether the terminal reports focus and blur events.
The terminal sends the following encoding:
CSI I // Focus In CSI O // Focus Out
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Focus-Tracking
const ( ReportFocusMode = DECMode(1004) EnableReportFocus = "\x1b[?1004h" DisableReportFocus = "\x1b[?1004l" RequestReportFocus = "\x1b[?1004$p" )
Deprecated: use SetFocusEventMode, ResetFocusEventMode, and RequestFocusEventMode instead.
const ( SgrExtMouseMode = DECMode(1006) SetSgrExtMouseMode = "\x1b[?1006h" ResetSgrExtMouseMode = "\x1b[?1006l" RequestSgrExtMouseMode = "\x1b[?1006$p" )
SGR Extended Mouse Mode is a mode that changes the mouse tracking encoding to use SGR parameters.
The terminal responds with the following encoding:
CSI < Cb ; Cx ; Cy M
Where Cb is the same as NormalMouseMode, and Cx and Cy are the x and y.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( MouseSgrExtMode = DECMode(1006) EnableMouseSgrExt = "\x1b[?1006h" DisableMouseSgrExt = "\x1b[?1006l" RequestMouseSgrExt = "\x1b[?1006$p" )
Deprecated: use SgrExtMouseMode SetSgrExtMouseMode, ResetSgrExtMouseMode, and RequestSgrExtMouseMode instead.
const ( Utf8ExtMouseMode = DECMode(1005) SetUtf8ExtMouseMode = "\x1b[?1005h" ResetUtf8ExtMouseMode = "\x1b[?1005l" RequestUtf8ExtMouseMode = "\x1b[?1005$p" )
UTF-8 Extended Mouse Mode is a mode that changes the mouse tracking encoding to use UTF-8 parameters.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( UrxvtExtMouseMode = DECMode(1015) SetUrxvtExtMouseMode = "\x1b[?1015h" ResetUrxvtExtMouseMode = "\x1b[?1015l" RequestUrxvtExtMouseMode = "\x1b[?1015$p" )
URXVT Extended Mouse Mode is a mode that changes the mouse tracking encoding to use an alternate encoding.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( SgrPixelExtMouseMode = DECMode(1016) SetSgrPixelExtMouseMode = "\x1b[?1016h" ResetSgrPixelExtMouseMode = "\x1b[?1016l" RequestSgrPixelExtMouseMode = "\x1b[?1016$p" )
SGR Pixel Extended Mouse Mode is a mode that changes the mouse tracking encoding to use SGR parameters with pixel coordinates.
This is similar to SgrExtMouseMode, but also reports pixel coordinates.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( AltScreenMode = DECMode(1047) SetAltScreenMode = "\x1b[?1047h" ResetAltScreenMode = "\x1b[?1047l" RequestAltScreenMode = "\x1b[?1047$p" )
Alternate Screen Mode is a mode that determines whether the alternate screen buffer is active. When this mode is enabled, the alternate screen buffer is cleared.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
const ( SaveCursorMode = DECMode(1048) SetSaveCursorMode = "\x1b[?1048h" ResetSaveCursorMode = "\x1b[?1048l" RequestSaveCursorMode = "\x1b[?1048$p" )
Save Cursor Mode is a mode that saves the cursor position. This is equivalent to SaveCursor and RestoreCursor.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
const ( AltScreenSaveCursorMode = DECMode(1049) SetAltScreenSaveCursorMode = "\x1b[?1049h" ResetAltScreenSaveCursorMode = "\x1b[?1049l" RequestAltScreenSaveCursorMode = "\x1b[?1049$p" )
Alternate Screen Save Cursor Mode is a mode that saves the cursor position as in SaveCursorMode, switches to the alternate screen buffer as in AltScreenMode, and clears the screen on switch.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
const ( AltScreenBufferMode = DECMode(1049) SetAltScreenBufferMode = "\x1b[?1049h" ResetAltScreenBufferMode = "\x1b[?1049l" RequestAltScreenBufferMode = "\x1b[?1049$p" EnableAltScreenBuffer = "\x1b[?1049h" DisableAltScreenBuffer = "\x1b[?1049l" RequestAltScreenBuffer = "\x1b[?1049$p" )
Alternate Screen Buffer is a mode that determines whether the alternate screen buffer is active.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
Deprecated: use AltScreenSaveCursorMode instead.
const ( BracketedPasteMode = DECMode(2004) SetBracketedPasteMode = "\x1b[?2004h" ResetBracketedPasteMode = "\x1b[?2004l" RequestBracketedPasteMode = "\x1b[?2004$p" )
Bracketed Paste Mode is a mode that determines whether pasted text is bracketed with escape sequences.
See: https://cirw.in/blog/bracketed-paste See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode
const ( EnableBracketedPaste = "\x1b[?2004h" DisableBracketedPaste = "\x1b[?2004l" RequestBracketedPaste = "\x1b[?2004$p" )
Deprecated: use SetBracketedPasteMode, ResetBracketedPasteMode, and RequestBracketedPasteMode instead.
const ( SynchronizedOutputMode = DECMode(2026) SetSynchronizedOutputMode = "\x1b[?2026h" ResetSynchronizedOutputMode = "\x1b[?2026l" RequestSynchronizedOutputMode = "\x1b[?2026$p" )
Synchronized Output Mode is a mode that determines whether output is synchronized with the terminal.
See: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
const ( SyncdOutputMode = DECMode(2026) EnableSyncdOutput = "\x1b[?2026h" DisableSyncdOutput = "\x1b[?2026l" RequestSyncdOutput = "\x1b[?2026$p" )
Deprecated: use SynchronizedOutputMode, SetSynchronizedOutputMode, and ResetSynchronizedOutputMode, and RequestSynchronizedOutputMode instead.
const ( GraphemeClusteringMode = DECMode(2027) SetGraphemeClusteringMode = "\x1b[?2027h" ResetGraphemeClusteringMode = "\x1b[?2027l" RequestGraphemeClusteringMode = "\x1b[?2027$p" )
Grapheme Clustering Mode is a mode that determines whether the terminal should look for grapheme clusters instead of single runes in the rendered text. This makes the terminal properly render combining characters such as emojis.
See: https://github.com/contour-terminal/terminal-unicode-core
const ( EnableGraphemeClustering = "\x1b[?2027h" DisableGraphemeClustering = "\x1b[?2027l" RequestGraphemeClustering = "\x1b[?2027$p" )
Deprecated: use SetGraphemeClusteringMode, ResetGraphemeClusteringMode, and RequestGraphemeClusteringMode instead.
const ( Win32InputMode = DECMode(9001) SetWin32InputMode = "\x1b[?9001h" ResetWin32InputMode = "\x1b[?9001l" RequestWin32InputMode = "\x1b[?9001$p" )
Win32Input is a mode that determines whether input is processed by the Win32 console and Conpty.
const ( EnableWin32Input = "\x1b[?9001h" DisableWin32Input = "\x1b[?9001l" RequestWin32Input = "\x1b[?9001$p" )
Deprecated: use SetWin32InputMode, ResetWin32InputMode, and RequestWin32InputMode instead.
const ( ResetInitialState = "\x1bc" RIS = ResetInitialState )
ResetInitialState (RIS) resets the terminal to its initial state.
ESC c
See: https://vt100.net/docs/vt510-rm/RIS.html
const ( EraseScreenBelow = "\x1b[J" EraseScreenAbove = "\x1b[1J" EraseEntireScreen = "\x1b[2J" EraseEntireDisplay = "\x1b[3J" )
EraseDisplay constants. These are the possible values for the EraseDisplay function.
const ( EraseLineRight = "\x1b[K" EraseLineLeft = "\x1b[1K" EraseEntireLine = "\x1b[2K" )
EraseLine constants. These are the possible values for the EraseLine function.
const ( SetTabEvery8Columns = "\x1b[?5W" DECST8C = SetTabEvery8Columns )
SetTabEvery8Columns (DECST8C) sets the tab stops at every 8 columns.
CSI ? 5 W
See: https://vt100.net/docs/vt510-rm/DECST8C.html
const ( SetModifyOtherKeys1 = "\x1b[>4;1m" SetModifyOtherKeys2 = "\x1b[>4;2m" ResetModifyOtherKeys = "\x1b[>4m" QueryModifyOtherKeys = "\x1b[?4m" )
Modify Other Keys (modifyOtherKeys) is an xterm feature that allows the terminal to modify the behavior of certain keys to send different escape sequences when pressed.
See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys
const Blur = "\x1b[O"
Blur is an escape sequence to notify the terminal that it has lost focus. This is used with FocusEventMode.
const BracketedPasteEnd = "\x1b[201~"
BracketedPasteEnd is the control sequence to disable bracketed paste mode.
const BracketedPasteStart = "\x1b[200~"
BracketedPasteStart is the control sequence to enable bracketed paste mode.
const CUB1 = "\x1b[D"
CUB1 is a sequence for moving the cursor left one cell.
const CUD1 = "\x1b[B"
CUD1 is a sequence for moving the cursor down one cell.
const CUF1 = "\x1b[C"
CUF1 is a sequence for moving the cursor right one cell.
const CUU1 = "\x1b[A"
CUU1 is a sequence for moving the cursor up one cell.
const CursorDown1 = "\x1b[B"
CursorDown1 is a sequence for moving the cursor down one cell.
This is equivalent to CursorDown(1). Deprecated: use CUD1 instead.
const CursorHomePosition = "\x1b[H"
CursorHomePosition is a sequence for moving the cursor to the upper left corner of the scrolling region. This is equivalent to `CursorPosition(1, 1)`.
const CursorLeft1 = CUB1
CursorLeft1 is a sequence for moving the cursor left one cell.
This is equivalent to CursorLeft(1). Deprecated: use CUB1 instead.
const CursorOrigin = "\x1b[1;1H"
CursorOrigin is a sequence for moving the cursor to the upper left corner of the display. This is equivalent to `SetCursorPosition(1, 1)`.
Deprecated: use CursorHomePosition instead.
const CursorRight1 = CUF1
CursorRight1 is a sequence for moving the cursor right one cell.
This is equivalent to CursorRight(1). Deprecated: use CUF1 instead.
const CursorUp1 = "\x1b[A"
CursorUp1 is a sequence for moving the cursor up one cell.
This is equivalent to CursorUp(1). Deprecated: use CUU1 instead.
const DisableKittyKeyboard = "\x1b[>0u"
DisableKittyKeyboard is a sequence to push zero into the terminal Kitty Keyboard stack to disable the protocol.
This is equivalent to PushKittyKeyboard(0).
const DisableModifyOtherKeys = "\x1b[>4;0m"
DisableModifyOtherKeys disables the modifyOtherKeys mode.
CSI > 4 ; 0 m
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys Deprecated: use ResetModifyOtherKeys instead.
const EnableModifyOtherKeys1 = "\x1b[>4;1m"
EnableModifyOtherKeys1 enables the modifyOtherKeys mode 1.
CSI > 4 ; 1 m
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys Deprecated: use SetModifyOtherKeys1 instead.
const EnableModifyOtherKeys2 = "\x1b[>4;2m"
EnableModifyOtherKeys2 enables the modifyOtherKeys mode 2.
CSI > 4 ; 2 m
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys Deprecated: use SetModifyOtherKeys2 instead.
const Focus = "\x1b[I"
Focus is an escape sequence to notify the terminal that it has focus. This is used with FocusEventMode.
const HomeCursorPosition = CursorHomePosition
HomeCursorPosition is a sequence for moving the cursor to the upper left corner of the scrolling region. This is equivalent to `SetCursorPosition(1, 1)`. Deprecated: use CursorHomePosition instead.
const HorizontalTabSet = "\x1bH"
HorizontalTabSet (HTS) sets a horizontal tab stop at the current cursor column.
This is equivalent to HTS.
ESC H
See: https://vt100.net/docs/vt510-rm/HTS.html
const HorizontalVerticalHomePosition = "\x1b[f"
HorizontalVerticalHomePosition is a sequence for moving the cursor to the upper left corner of the scrolling region. This is equivalent to `HorizontalVerticalPosition(1, 1)`.
const Index = "\x1bD"
Index (IND) is an escape sequence for moving the cursor down one line in the same column. If the cursor is at the bottom margin, the screen scrolls up. This has the same effect as IND.
const LS1R = "\x1b~"
Locking Shift 1 Right (LS1R) shifts G1 into GR character set.
const LS2 = "\x1bn"
Locking Shift 2 (LS2) shifts G2 into GL character set.
const LS2R = "\x1b}"
Locking Shift 2 Right (LS2R) shifts G2 into GR character set.
const LS3 = "\x1bo"
Locking Shift 3 (LS3) shifts G3 into GL character set.
const LS3R = "\x1b|"
Locking Shift 3 Right (LS3R) shifts G3 into GR character set.
const MoveCursorOrigin = CursorOrigin
MoveCursorOrigin is a sequence for moving the cursor to the upper left corner of the display. This is equivalent to `SetCursorPosition(1, 1)`.
Deprecated: use CursorHomePosition instead.
const RequestBackgroundColor = "\x1b]11;?\x07"
RequestBackgroundColor is a sequence that requests the current default terminal background color.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
const RequestCursorColor = "\x1b]12;?\x07"
RequestCursorColor is a sequence that requests the current terminal cursor color.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
const RequestCursorPosition = "\x1b[6n"
RequestCursorPosition is an escape sequence that requests the current cursor position.
CSI 6 n
The terminal will report the cursor position as a CSI sequence in the following format:
CSI Pl ; Pc R
Where Pl is the line number and Pc is the column number. See: https://vt100.net/docs/vt510-rm/CPR.html
const RequestExtendedCursorPosition = "\x1b[?6n"
RequestExtendedCursorPosition (DECXCPR) is a sequence for requesting the cursor position report including the current page number.
CSI ? 6 n
The terminal will report the cursor position as a CSI sequence in the following format:
CSI ? Pl ; Pc ; Pp R
Where Pl is the line number, Pc is the column number, and Pp is the page number. See: https://vt100.net/docs/vt510-rm/DECXCPR.html
const RequestForegroundColor = "\x1b]10;?\x07"
RequestForegroundColor is a sequence that requests the current default terminal foreground color.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
const RequestKittyKeyboard = "\x1b[?u"
RequestKittyKeyboard is a sequence to request the terminal Kitty keyboard protocol enabled flags.
See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
const RequestModifyOtherKeys = "\x1b[?4m"
RequestModifyOtherKeys requests the modifyOtherKeys mode.
CSI ? 4 m
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys Deprecated: use QueryModifyOtherKeys instead.
const RequestPrimaryClipboard = "\x1b]52;p;?\x07"
RequestPrimaryClipboard is a sequence for requesting the primary clipboard.
This is equivalent to RequestClipboard(PrimaryClipboard).
const RequestPrimaryDeviceAttributes = "\x1b[c"
RequestPrimaryDeviceAttributes is a control sequence that requests the terminal's primary device attributes (DA1).
CSI c
See https://vt100.net/docs/vt510-rm/DA1.html
const RequestSystemClipboard = "\x1b]52;c;?\x07"
RequestSystemClipboard is a sequence for requesting the system clipboard.
This is equivalent to RequestClipboard(SystemClipboard).
const RequestXTVersion = RequestNameVersion
RequestXTVersion is a control sequence that requests the terminal's XTVERSION. It responds with a DSR sequence identifying the version.
CSI > Ps q DCS > | text ST
See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys Deprecated: use RequestNameVersion instead.
const ResetBackgroundColor = "\x1b]111\x07"
ResetBackgroundColor is a sequence that resets the default terminal background color.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
const ResetCursorColor = "\x1b]112\x07"
ResetCursorColor is a sequence that resets the terminal cursor color.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
const ResetForegroundColor = "\x1b]110\x07"
ResetForegroundColor is a sequence that resets the default terminal foreground color.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
const ResetPrimaryClipboard = "\x1b]52;p;\x07"
ResetPrimaryClipboard is a sequence for resetting the primary clipboard.
This is equivalent to ResetClipboard(PrimaryClipboard).
const ResetStyle = "\x1b[m"
ResetStyle is a SGR (Select Graphic Rendition) style sequence that resets all attributes. See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
const ResetSystemClipboard = "\x1b]52;c;\x07"
ResetSystemClipboard is a sequence for resetting the system clipboard.
This is equivalent to ResetClipboard(SystemClipboard).
const RestoreCursorPosition = "\x1b[u"
RestoreCursorPosition (RCP or SCORC) is a sequence for restoring the cursor position.
CSI u
This acts like Restore, except the cursor stays on the same page where the cursor was saved.
See: https://vt100.net/docs/vt510-rm/SCORC.html Deprecated: use RestoreCurrentCursorPosition instead.
const ReverseIndex = "\x1bM"
ReverseIndex (RI) is an escape sequence for moving the cursor up one line in the same column. If the cursor is at the top margin, the screen scrolls down.
This has the same effect as RI.
const SaveCursorPosition = "\x1b[s"
SaveCursorPosition (SCP or SCOSC) is a sequence for saving the cursor position.
CSI s
This acts like Save, except the page number where the cursor is located is not saved.
See: https://vt100.net/docs/vt510-rm/SCOSC.html Deprecated: use SaveCurrentCursorPosition instead.
Variables ¶
This section is empty.
Functions ¶
func CPR ¶ added in v0.5.0
CPR is an alias for CursorPositionReport.
func CursorBackward ¶ added in v0.5.0
CursorBackward (CUB) returns a sequence for moving the cursor left n cells.
CSI n D ¶
func CursorBackwardTab ¶ added in v0.5.0
CursorBackwardTab (CBT) returns a sequence for moving the cursor to the previous tab stop n times.
Default is 1.
CSI n Z
func CursorForward ¶ added in v0.5.0
CursorForward (CUF) returns a sequence for moving the cursor right n cells.
CSI n C ¶
func CursorHorizontalAbsolute ¶ added in v0.5.0
CursorHorizontalAbsolute (CHA) returns a sequence for moving the cursor to the given column.
Default is 1.
CSI n G
func CursorHorizontalForwardTab ¶ added in v0.5.0
CursorHorizontalForwardTab (CHT) returns a sequence for moving the cursor to the next tab stop n times.
Default is 1.
CSI n I
func CursorInformationReport ¶ added in v0.5.0
CursorInformationReport (DECCIR) is the response to a cursor information report request. It reports the cursor position, visual attributes, and character protection attributes. It also reports the status of origin mode DECOM and the current active character set.
The response is a list of values separated by a semicolon (;) character.
DCS 1 $ u D ... D ST
Where D is a decimal number representing a value.
func CursorLeft ¶
CursorLeft (CUB) returns a sequence for moving the cursor left n cells.
CSI n D
See: https://vt100.net/docs/vt510-rm/CUB.html Deprecated: use CursorBackward instead.
func CursorNextLine ¶
CursorNextLine (CNL) returns a sequence for moving the cursor to the beginning of the next line n times.
CSI n E
func CursorPosition ¶ added in v0.5.0
CursorPosition (CUP) returns a sequence for setting the cursor to the given row and column.
Default is 1,1.
CSI n ; m H
func CursorPositionReport ¶ added in v0.5.0
CursorPositionReport (CPR) is a control sequence that reports the cursor's position.
CSI Pl ; Pc R
Where Pl is the line number and Pc is the column number.
func CursorPreviousLine ¶
CursorPreviousLine (CPL) returns a sequence for moving the cursor to the beginning of the previous line n times.
CSI n F
func CursorRight ¶
CursorRight (CUF) returns a sequence for moving the cursor right n cells.
CSI n C
See: https://vt100.net/docs/vt510-rm/CUF.html Deprecated: use CursorForward instead.
func DA1 ¶ added in v0.5.0
DA1 is an alias for PrimaryDeviceAttributes.
func DA2 ¶ added in v0.5.0
DA2 is an alias for SecondaryDeviceAttributes.
func DA3 ¶ added in v0.5.0
DA3 is an alias for TertiaryDeviceAttributes.
func DECCIR ¶ added in v0.5.0
DECCIR is an alias for CursorInformationReport.
func DECRPM ¶ added in v0.5.0
func DECRPM(mode Mode, value ModeSetting) string
DECRPM is an alias for ReportMode.
func DECRQPSR ¶ added in v0.5.0
DECRQPSR is an alias for RequestPresentationStateReport.
func DECSCUSR ¶ added in v0.5.0
DECSCUSR is an alias for SetCursorStyle.
func DECSLRM ¶ added in v0.5.0
DECSLRM is an alias for SetLeftRightMargins.
func DECSTBM ¶ added in v0.5.0
DECSTBM is an alias for SetTopBottomMargins.
func DECTABSR ¶ added in v0.5.0
DECTABSR is an alias for TabStopReport.
func DECXCPR ¶ added in v0.5.0
DECXCPR is an alias for ExtendedCursorPositionReport.
func DecodeSequence ¶ added in v0.2.0
func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width int, n int, newState byte)
DecodeSequence decodes the first ANSI escape sequence or a printable grapheme from the given data. It returns the sequence slice, the number of bytes read, the cell width for each sequence, and the new state.
The cell width will always be 0 for control and escape sequences, 1 for ASCII printable characters, and the number of cells other Unicode characters occupy. It uses the uniseg package to calculate the width of Unicode graphemes and characters. This means it will always do grapheme clustering (mode 2027).
Passing a non-nil *Parser as the last argument will allow the decoder to collect sequence parameters, data, and commands. The parser cmd will have the packed command value that contains intermediate and marker characters. In the case of a OSC sequence, the cmd will be the OSC command number. Use Command and Parameter types to unpack command intermediates and markers as well as parameters.
Zero Command means the CSI, DCS, or ESC sequence is invalid. Moreover, checking the validity of other data sequences, OSC, DCS, etc, will require checking for the returned sequence terminator bytes such as ST (ESC \\) and BEL).
We store the command byte in Command in the most significant byte, the marker byte in the next byte, and the intermediate byte in the least significant byte. This is done to avoid using a struct to store the command and its intermediates and markers. The command byte is always the least significant byte i.e. [Cmd & 0xff]. Use the Command type to unpack the command, intermediate, and marker bytes. Note that we only collect the last marker character and intermediate byte.
The [p.Params] slice will contain the parameters of the sequence. Any sub-parameter will have the parser.HasMoreFlag set. Use the Parameter type to unpack the parameters.
Example:
var state byte // the initial state is always zero [NormalState]
p := NewParser(32, 1024) // create a new parser with a 32 params buffer and 1024 data buffer (optional)
input := []byte("\x1b[31mHello, World!\x1b[0m")
for len(input) > 0 {
seq, width, n, newState := DecodeSequence(input, state, p)
log.Printf("seq: %q, width: %d", seq, width)
state = newState
input = input[n:]
}
func DeleteCharacter ¶ added in v0.5.0
DeleteCharacter (DCH) deletes n characters at the current cursor position. As the characters are deleted, the remaining characters move to the left and the cursor remains at the same position.
Default is 1.
CSI Pn P
func DeleteLine ¶
DeleteLine (DL) deletes n lines at the current cursor position. Existing lines are moved up.
CSI Pn M
func DeviceStatusReport ¶ added in v0.5.0
DeviceStatusReport (DSR) is a control sequence that reports the terminal's status. The terminal responds with a DSR sequence.
CSI Ps n CSI ? Ps n
If one of the statuses is a DECStatus, the sequence will use the DEC format.
func EraseCharacter ¶ added in v0.5.0
EraseCharacter (ECH) returns a sequence for erasing n characters and moving the cursor to the right. This doesn't affect other cell attributes.
Default is 1.
CSI n X
func EraseDisplay ¶
EraseDisplay (ED) clears the display or parts of the display. A screen is the shown part of the terminal display excluding the scrollback buffer. Possible values:
Default is 0.
0: Clear from cursor to end of screen. 1: Clear from cursor to beginning of the screen. 2: Clear entire screen (and moves cursor to upper left on DOS). 3: Clear entire display which delete all lines saved in the scrollback buffer (xterm). CSI <n> J
func EraseLine ¶
EraseLine (EL) clears the current line or parts of the line. Possible values:
0: Clear from cursor to end of line. 1: Clear from cursor to beginning of the line. 2: Clear entire line.
The cursor position is not affected.
CSI <n> K
func Execute ¶
Execute is a function that "execute" the given escape sequence by writing it to the provided output writter.
This is a syntactic sugar over io.WriteString.
func ExtendedCursorPositionReport ¶ added in v0.5.0
ExtendedCursorPositionReport (DECXCPR) is a control sequence that reports the cursor's position along with the page number (optional).
CSI ? Pl ; Pc R CSI ? Pl ; Pc ; Pv R
Where Pl is the line number, Pc is the column number, and Pv is the page number.
If the page number is zero or negative, the returned sequence won't include the page number.
func FirstGraphemeCluster ¶ added in v0.2.0
FirstGraphemeCluster returns the first grapheme cluster in the given string or byte slice. This is a syntactic sugar function that wraps uniseg.FirstGraphemeClusterInString and uniseg.FirstGraphemeCluster.
func HVP ¶ added in v0.5.0
HVP is an alias for HorizontalVerticalPosition.
func Hardwrap ¶
Hardwrap wraps a string or a block of text to a given line length, breaking word boundaries. This will preserve ANSI escape codes and will account for wide-characters in the string. When preserveSpace is true, spaces at the beginning of a line will be preserved.
func HasApcPrefix ¶ added in v0.2.0
HasApcPrefix returns true if the given byte slice has an APC prefix.
func HasCsiPrefix ¶ added in v0.2.0
HasCsiPrefix returns true if the given byte slice has a CSI prefix.
func HasDcsPrefix ¶ added in v0.2.0
HasDcsPrefix returns true if the given byte slice has a DCS prefix.
func HasEscPrefix ¶ added in v0.2.0
HasEscPrefix returns true if the given byte slice has an ESC prefix.
func HasOscPrefix ¶ added in v0.2.0
HasOscPrefix returns true if the given byte slice has an OSC prefix.
func HasPmPrefix ¶ added in v0.2.0
HasPmPrefix returns true if the given byte slice has a PM prefix.
func HasSosPrefix ¶ added in v0.2.0
HasSosPrefix returns true if the given byte slice has a SOS prefix.
func HasStPrefix ¶ added in v0.2.0
HasStPrefix returns true if the given byte slice has a ST prefix.
func HorizontalPositionAbsolute ¶ added in v0.5.0
HorizontalPositionAbsolute (HPA) returns a sequence for moving the cursor to the given column. This has the same effect as CUP.
Default is 1.
CSI n `
func HorizontalPositionRelative ¶ added in v0.5.0
HorizontalPositionRelative (HPR) returns a sequence for moving the cursor right n columns relative to the current position. This has the same effect as CUP.
Default is 1.
CSI n a
func HorizontalVerticalPosition ¶ added in v0.5.0
HorizontalVerticalPosition (HVP) returns a sequence for moving the cursor to the given row and column.
Default is 1,1.
CSI n ; m f
This has the same effect as CursorPosition.
func InsertCharacter ¶ added in v0.5.0
InsertCharacter (ICH) inserts n blank characters at the current cursor position. Existing characters move to the right. Characters moved past the right margin are lost. ICH has no effect outside the scrolling margins.
Default is 1.
CSI Pn @
func InsertLine ¶
InsertLine (IL) inserts n blank lines at the current cursor position. Existing lines are moved down.
CSI Pn L
func KeyModifierOptions ¶ added in v0.5.0
KeyModifierOptions (XTMODKEYS) sets/resets xterm key modifier options.
Default is 0.
CSI > Pp m CSI > Pp ; Pv m
If Pv is omitted, the resource is reset to its initial value.
func KittyKeyboard ¶ added in v0.2.0
KittyKeyboard returns a sequence to request keyboard enhancements from the terminal. The flags argument is a bitmask of the Kitty keyboard protocol flags. While mode specifies how the flags should be interpreted.
Possible values for flags mask:
1: Disambiguate escape codes 2: Report event types 4: Report alternate keys 8: Report all keys as escape codes 16: Report associated text
Possible values for mode:
1: Set given flags and unset all others 2: Set given flags and keep existing flags unchanged 3: Unset given flags and keep existing flags unchanged
See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
func ModifyOtherKeys ¶ added in v0.2.0
ModifyOtherKeys returns a sequence that sets XTerm modifyOtherKeys mode. The mode argument specifies the mode to set.
0: Disable modifyOtherKeys mode. 1: Enable modifyOtherKeys mode 1. 2: Enable modifyOtherKeys mode 2. CSI > 4 ; mode m
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys Deprecated: use SetModifyOtherKeys1 or SetModifyOtherKeys2 instead.
func MouseSgr ¶ added in v0.5.0
MouseSgr returns an escape sequence representing a mouse event in SGR mode.
CSI < Cb ; Cx ; Cy M CSI < Cb ; Cx ; Cy m (release)
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking
func MouseX10 ¶ added in v0.5.0
MouseX10 returns an escape sequence representing a mouse event in X10 mode. Note that this requires the terminal support X10 mouse modes.
CSI M Cb Cx Cy
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking
func MoveCursor
deprecated
MoveCursor (CUP) returns a sequence for setting the cursor to the given row and column.
CSI n ; m H
See: https://vt100.net/docs/vt510-rm/CUP.html
Deprecated: use CursorPosition instead.
func Notify ¶ added in v0.4.3
Notify sends a desktop notification using iTerm's OSC 9.
OSC 9 ; Mc ST OSC 9 ; Mc BEL
Where Mc is the notification body.
func Params ¶
Params parses and returns a list of control sequence parameters.
Parameters are positive integers separated by semicolons. Empty parameters default to zero. Parameters can have sub-parameters separated by colons.
Any non-parameter bytes are ignored. This includes bytes that are not in the range of 0x30-0x3B.
See ECMA-48 § 5.4.1.
func PopKittyKeyboard ¶
PopKittyKeyboard returns a sequence to pop n number of flags from the terminal Kitty Keyboard stack.
CSI < flags u
See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
func PrimaryDeviceAttributes ¶ added in v0.5.0
PrimaryDeviceAttributes (DA1) is a control sequence that reports the terminal's primary device attributes.
CSI c CSI 0 c CSI ? Ps ; ... c
If no attributes are given, or if the attribute is 0, this function returns the request sequence. Otherwise, it returns the response sequence.
func PushKittyKeyboard ¶
PushKittyKeyboard returns a sequence to push the given flags to the terminal Kitty Keyboard stack.
Possible values for flags mask:
0: Disable all features 1: Disambiguate escape codes 2: Report event types 4: Report alternate keys 8: Report all keys as escape codes 16: Report associated text CSI > flags u
See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
func PutParser ¶ added in v0.3.1
func PutParser(p *Parser)
PutParser returns a parser to a sync pool. The parser is reset automatically.
func QueryKeyModifierOptions ¶ added in v0.5.0
QueryKeyModifierOptions (XTQMODKEYS) requests xterm key modifier options.
Default is 0.
CSI ? Pp m
func RepeatPreviousCharacter ¶ added in v0.5.0
RepeatPreviousCharacter (REP) repeats the previous character n times. This is identical to typing the same character n times.
Default is 1.
CSI Pn b
See: ECMA-48 § 8.3.103
func ReportMode ¶ added in v0.5.0
func ReportMode(mode Mode, value ModeSetting) string
ReportMode (DECRPM) returns a sequence that the terminal sends to the host in response to a mode request DECRQM.
ANSI format:
CSI Pa ; Ps ; $ y
DEC format:
CSI ? Pa ; Ps $ y
Where Pa is the mode number, and Ps is the mode value.
0: Not recognized 1: Set 2: Reset 3: Permanent set 4: Permanent reset
func RequestClipboard ¶
RequestClipboard returns a sequence for requesting the clipboard.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func RequestMode ¶ added in v0.5.0
RequestMode (DECRQM) returns a sequence to request a mode from the terminal. The terminal responds with a report mode function DECRPM.
ANSI format:
CSI Pa $ p
DEC format:
CSI ? Pa $ p
func RequestPresentationStateReport ¶ added in v0.5.0
RequestPresentationStateReport (DECRQPSR) requests the terminal to send a report of the presentation state. This includes the cursor information DECCIR, and tab stop DECTABSR reports.
Default is 0.
Possible values: 0: Error, request ignored. 1: Cursor information report DECCIR. 2: Tab stop report DECTABSR.
CSI Ps $ w
func RequestTermcap ¶
RequestTermcap is an alias for XTGETTCAP.
func RequestTerminfo ¶ added in v0.5.0
RequestTerminfo is an alias for XTGETTCAP.
func ResetClipboard ¶
ResetClipboard returns a sequence for resetting the clipboard.
This is equivalent to SetClipboard(c, "").
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func ResetHyperlink ¶
ResetHyperlink returns a sequence for resetting the hyperlink.
This is equivalent to SetHyperlink("", params...).
See: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
func ResetKeyModifierOptions ¶ added in v0.5.0
ResetKeyModifierOptions resets xterm key modifier options. This is an alias for KeyModifierOptions.
func ResetMode ¶ added in v0.5.0
ResetMode (RM) returns a sequence to reset a mode. The mode arguments are a list of modes to reset.
If one of the modes is a DECMode, the sequence will use the DEC format.
ANSI format:
CSI Pd ; ... ; Pd l
DEC format:
CSI ? Pd ; ... ; Pd l
func ScreenPassthrough ¶
ScreenPassthrough wraps the given ANSI sequence in a DCS passthrough sequence to be sent to the outer terminal. This is used to send raw escape sequences to the outer terminal when running inside GNU Screen.
DCS <data> ST
Note: Screen limits the length of string sequences to 768 bytes (since 2014). Use zero to indicate no limit, otherwise, this will chunk the returned string into limit sized chunks.
See: https://www.gnu.org/software/screen/manual/screen.html#String-Escapes See: https://git.savannah.gnu.org/cgit/screen.git/tree/src/screen.h?id=c184c6ec27683ff1a860c45be5cf520d896fd2ef#n44
func ScrollDown ¶
ScrollDown (SD) scrolls the screen down n lines. New lines are added at the top of the screen.
CSI Pn T
func ScrollUp ¶
ScrollUp (SU) scrolls the screen up n lines. New lines are added at the bottom of the screen.
CSI Pn S
func SecondaryDeviceAttributes ¶ added in v0.5.0
SecondaryDeviceAttributes (DA2) is a control sequence that reports the terminal's secondary device attributes.
CSI > c CSI > 0 c CSI > Ps ; ... c
func SelectCharacterSet ¶ added in v0.5.0
SelectCharacterSet sets the G-set character designator to the specified character set.
ESC Ps Pd
Where Ps is the G-set character designator, and Pd is the identifier. For 94-character sets, the designator can be one of:
- ( G0
- ) G1
- * G2
- + G3
For 96-character sets, the designator can be one of:
- - G1
- . G2
- / G3
Some common 94-character sets are:
- 0 DEC Special Drawing Set
- A United Kingdom (UK)
- B United States (USASCII)
Examples:
ESC ( B Select character set G0 = United States (USASCII) ESC ( 0 Select character set G0 = Special Character and Line Drawing Set ESC ) 0 Select character set G1 = Special Character and Line Drawing Set ESC * A Select character set G2 = United Kingdom (UK)
func SelectGraphicRendition ¶ added in v0.5.0
Select Graphic Rendition (SGR) is a command that sets display attributes.
Default is 0.
CSI Ps ; Ps ... m
func SetBackgroundColor ¶
SetBackgroundColor returns a sequence that sets the default terminal background color.
OSC 11 ; color ST OSC 11 ; color BEL
Where color is the encoded color number.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func SetClipboard ¶
SetClipboard returns a sequence for manipulating the clipboard.
OSC 52 ; Pc ; Pd ST OSC 52 ; Pc ; Pd BEL
Where Pc is the clipboard name and Pd is the base64 encoded data. Empty data or invalid base64 data will reset the clipboard.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func SetCursorColor ¶
SetCursorColor returns a sequence that sets the terminal cursor color.
OSC 12 ; color ST OSC 12 ; color BEL
Where color is the encoded color number.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func SetCursorPosition ¶ added in v0.4.0
SetCursorPosition (CUP) returns a sequence for setting the cursor to the given row and column.
CSI n ; m H
See: https://vt100.net/docs/vt510-rm/CUP.html Deprecated: use CursorPosition instead.
func SetCursorStyle ¶ added in v0.2.2
SetCursorStyle (DECSCUSR) returns a sequence for changing the cursor style.
Default is 1.
CSI Ps SP q
Where Ps is the cursor style:
0: Blinking block 1: Blinking block (default) 2: Steady block 3: Blinking underline 4: Steady underline 5: Blinking bar (xterm) 6: Steady bar (xterm)
See: https://vt100.net/docs/vt510-rm/DECSCUSR.html See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81
func SetForegroundColor ¶
SetForegroundColor returns a sequence that sets the default terminal foreground color.
OSC 10 ; color ST OSC 10 ; color BEL
Where color is the encoded color number.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func SetHyperlink ¶
SetHyperlink returns a sequence for starting a hyperlink.
OSC 8 ; Params ; Uri ST OSC 8 ; Params ; Uri BEL
To reset the hyperlink, omit the URI.
See: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
func SetIconName ¶
SetIconName returns a sequence for setting the icon name.
OSC 1 ; title ST OSC 1 ; title BEL
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func SetIconNameWindowTitle ¶
SetIconNameWindowTitle returns a sequence for setting the icon name and window title.
OSC 0 ; title ST OSC 0 ; title BEL
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func SetKeyModifierOptions ¶ added in v0.5.0
SetKeyModifierOptions sets xterm key modifier options. This is an alias for KeyModifierOptions.
func SetLeftRightMargins ¶ added in v0.5.0
SetLeftRightMargins (DECSLRM) sets the left and right margins for the scrolling region.
Default is 1 and the right of the screen.
CSI Pl ; Pr s
func SetMode ¶ added in v0.5.0
SetMode (SM) returns a sequence to set a mode. The mode arguments are a list of modes to set.
If one of the modes is a DECMode, the sequence will use the DEC format.
ANSI format:
CSI Pd ; ... ; Pd h
DEC format:
CSI ? Pd ; ... ; Pd h
func SetPointerShape ¶ added in v0.2.2
SetPointerShape returns a sequence for changing the mouse pointer cursor shape. Use "default" for the default pointer shape.
OSC 22 ; Pt ST OSC 22 ; Pt BEL
Where Pt is the pointer shape name. The name can be anything that the operating system can understand. Some common names are:
- copy
- crosshair
- default
- ew-resize
- n-resize
- text
- wait
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func SetPrimaryClipboard ¶
SetPrimaryClipboard returns a sequence for setting the primary clipboard.
This is equivalent to SetClipboard(PrimaryClipboard, d).
func SetScrollingRegion ¶
SetScrollingRegion (DECSTBM) sets the top and bottom margins for the scrolling region. The default is the entire screen.
CSI <top> ; <bottom> r
See: https://vt100.net/docs/vt510-rm/DECSTBM.html Deprecated: use SetTopBottomMargins instead.
func SetSystemClipboard ¶
SetSystemClipboard returns a sequence for setting the system clipboard.
This is equivalent to SetClipboard(SystemClipboard, d).
func SetTopBottomMargins ¶ added in v0.5.0
SetTopBottomMargins (DECSTBM) sets the top and bottom margins for the scrolling region. The default is the entire screen.
Default is 1 and the bottom of the screen.
CSI Pt ; Pb r
func SetWindowTitle ¶
SetWindowTitle returns a sequence for setting the window title.
OSC 2 ; title ST OSC 2 ; title BEL
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func StringWidth ¶
StringWidth returns the width of a string in cells. This is the number of cells that the string will occupy when printed in a terminal. ANSI escape codes are ignored and wide characters (such as East Asians and emojis) are accounted for.
func TabClear ¶ added in v0.5.0
TabClear (TBC) clears tab stops.
Default is 0.
Possible values: 0: Clear tab stop at the current column. (default) 3: Clear all tab stops.
CSI Pn g
func TabStopReport ¶ added in v0.5.0
TabStopReport (DECTABSR) is the response to a tab stop report request. It reports the tab stops set in the terminal.
The response is a list of tab stops separated by a slash (/) character.
DCS 2 $ u D ... D ST
Where D is a decimal number representing a tab stop.
func TertiaryDeviceAttributes ¶ added in v0.5.0
TertiaryDeviceAttributes (DA3) is a control sequence that reports the terminal's tertiary device attributes.
CSI = c CSI = 0 c DCS ! | Text ST
Where Text is the unit ID for the terminal.
If no unit ID is given, or if the unit ID is 0, this function returns the request sequence. Otherwise, it returns the response sequence.
func TmuxPassthrough ¶
TmuxPassthrough wraps the given ANSI sequence in a special DCS passthrough sequence to be sent to the outer terminal. This is used to send raw escape sequences to the outer terminal when running inside Tmux.
DCS tmux ; <escaped-data> ST
Where <escaped-data> is the given sequence in which all occurrences of ESC (0x1b) are doubled i.e. replaced with ESC ESC (0x1b 0x1b).
Note: this needs the `allow-passthrough` option to be set to `on`.
See: https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it
func Truncate ¶
Truncate truncates a string to a given length, adding a tail to the end if the string is longer than the given length. This function is aware of ANSI escape codes and will not break them, and accounts for wide-characters (such as East Asians and emojis).
func VerticalPositionAbsolute ¶ added in v0.5.0
VerticalPositionAbsolute (VPA) returns a sequence for moving the cursor to the given row.
Default is 1.
CSI n d
func VerticalPositionRelative ¶ added in v0.5.0
VerticalPositionRelative (VPR) returns a sequence for moving the cursor down n rows relative to the current position.
Default is 1.
CSI n e
func Wordwrap ¶
Wordwrap wraps a string or a block of text to a given line length, not breaking word boundaries. This will preserve ANSI escape codes and will account for wide-characters in the string. The breakpoints string is a list of characters that are considered breakpoints for word wrapping. A hyphen (-) is always considered a breakpoint.
Note: breakpoints must be a string of 1-cell wide rune characters.
func Wrap ¶
Wrap wraps a string or a block of text to a given line length, breaking word boundaries if necessary. This will preserve ANSI escape codes and will account for wide-characters in the string. The breakpoints string is a list of characters that are considered breakpoints for word wrapping. A hyphen (-) is always considered a breakpoint.
Note: breakpoints must be a string of 1-cell wide rune characters.
func XTGETTCAP ¶ added in v0.5.0
RequestTermcap (XTGETTCAP) requests Termcap/Terminfo strings.
DCS + q <Pt> ST
Where <Pt> is a list of Termcap/Terminfo capabilities, encoded in 2-digit hexadecimals, separated by semicolons.
See: https://man7.org/linux/man-pages/man5/terminfo.5.html See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
func XTMODKEYS ¶ added in v0.5.0
XTMODKEYS is an alias for KeyModifierOptions.
func XTQMODKEYS ¶ added in v0.5.0
XTQMODKEYS is an alias for QueryKeyModifierOptions.
Types ¶
type ANSIMode ¶ added in v0.5.0
type ANSIMode int //nolint:revive
ANSIMode represents an ANSI terminal mode.
type ANSIStatus ¶ added in v0.5.0
type ANSIStatus int //nolint:revive
ANSIStatus represents an ANSI terminal status report.
func (ANSIStatus) Status ¶ added in v0.5.0
func (s ANSIStatus) Status() int
Status returns the status report identifier.
type ApcSequence ¶
type ApcSequence struct {
// Data contains the raw data of the sequence.
Data []byte
}
ApcSequence represents an APC sequence.
func (ApcSequence) Clone ¶
func (a ApcSequence) Clone() Sequence
Clone returns a deep copy of the APC sequence.
type Attr ¶
type Attr = int
Attr is a SGR (Select Graphic Rendition) style attribute.
const ( ResetAttr Attr = 0 BoldAttr Attr = 1 FaintAttr Attr = 2 ItalicAttr Attr = 3 UnderlineAttr Attr = 4 SlowBlinkAttr Attr = 5 RapidBlinkAttr Attr = 6 ReverseAttr Attr = 7 ConcealAttr Attr = 8 StrikethroughAttr Attr = 9 NoBoldAttr Attr = 21 // Some terminals treat this as double underline. NormalIntensityAttr Attr = 22 NoItalicAttr Attr = 23 NoUnderlineAttr Attr = 24 NoBlinkAttr Attr = 25 NoReverseAttr Attr = 27 NoConcealAttr Attr = 28 NoStrikethroughAttr Attr = 29 BlackForegroundColorAttr Attr = 30 RedForegroundColorAttr Attr = 31 GreenForegroundColorAttr Attr = 32 YellowForegroundColorAttr Attr = 33 BlueForegroundColorAttr Attr = 34 MagentaForegroundColorAttr Attr = 35 CyanForegroundColorAttr Attr = 36 WhiteForegroundColorAttr Attr = 37 ExtendedForegroundColorAttr Attr = 38 DefaultForegroundColorAttr Attr = 39 BlackBackgroundColorAttr Attr = 40 RedBackgroundColorAttr Attr = 41 GreenBackgroundColorAttr Attr = 42 YellowBackgroundColorAttr Attr = 43 BlueBackgroundColorAttr Attr = 44 MagentaBackgroundColorAttr Attr = 45 CyanBackgroundColorAttr Attr = 46 WhiteBackgroundColorAttr Attr = 47 ExtendedBackgroundColorAttr Attr = 48 DefaultBackgroundColorAttr Attr = 49 ExtendedUnderlineColorAttr Attr = 58 DefaultUnderlineColorAttr Attr = 59 BrightBlackForegroundColorAttr Attr = 90 BrightRedForegroundColorAttr Attr = 91 BrightGreenForegroundColorAttr Attr = 92 BrightYellowForegroundColorAttr Attr = 93 BrightBlueForegroundColorAttr Attr = 94 BrightMagentaForegroundColorAttr Attr = 95 BrightCyanForegroundColorAttr Attr = 96 BrightWhiteForegroundColorAttr Attr = 97 BrightBlackBackgroundColorAttr Attr = 100 BrightRedBackgroundColorAttr Attr = 101 BrightGreenBackgroundColorAttr Attr = 102 BrightYellowBackgroundColorAttr Attr = 103 BrightBlueBackgroundColorAttr Attr = 104 BrightMagentaBackgroundColorAttr Attr = 105 BrightCyanBackgroundColorAttr Attr = 106 BrightWhiteBackgroundColorAttr Attr = 107 RGBColorIntroducerAttr Attr = 2 ExtendedColorIntroducerAttr Attr = 5 )
SGR (Select Graphic Rendition) style attributes. See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
type BasicColor ¶
type BasicColor uint8
BasicColor is an ANSI 3-bit or 4-bit color with a value from 0 to 15.
const ( // Black is the ANSI black color. Black BasicColor = iota // Red is the ANSI red color. Red // Green is the ANSI green color. Green // Yellow is the ANSI yellow color. Yellow // Blue is the ANSI blue color. Blue // Magenta is the ANSI magenta color. Magenta // Cyan is the ANSI cyan color. Cyan // White is the ANSI white color. White // BrightBlack is the ANSI bright black color. BrightBlack // BrightRed is the ANSI bright red color. BrightRed // BrightGreen is the ANSI bright green color. BrightGreen // BrightYellow is the ANSI bright yellow color. BrightYellow // BrightBlue is the ANSI bright blue color. BrightBlue // BrightMagenta is the ANSI bright magenta color. BrightMagenta // BrightCyan is the ANSI bright cyan color. BrightCyan // BrightWhite is the ANSI bright white color. BrightWhite )
type Color ¶
Color is a color that can be used in a terminal. ANSI (including ANSI256) and 24-bit "true colors" fall under this category.
type Colorizer ¶ added in v0.5.0
Colorizer is a color.Color interface that can be formatted as a string.
type Command ¶ added in v0.5.0
type Command int
Command represents a sequence command. This is used to pack/unpack a sequence command with its intermediate and marker characters. Those are commonly found in CSI and DCS sequences.
func Cmd ¶ added in v0.2.0
Cmd returns a packed Command with the given command, marker, and intermediate. The first byte is the command, the next shift is the marker, and the next shift is the intermediate.
Even though this function takes integers, it only uses the lower 8 bits of each integer.
func (Command) Command ¶ added in v0.5.0
Command returns the unpacked command byte of the CSI sequence.
func (Command) Intermediate ¶ added in v0.5.0
Intermediate returns the unpacked intermediate byte of the CSI sequence. An intermediate byte is in the range of 0x20-0x2F. This includes these characters from ' ', '!', '"', '#', '$', '%', '&', ”', '(', ')', '*', '+', ',', '-', '.', '/'. Zero is returned if the sequence does not have an intermediate byte.
type ControlCode ¶
type ControlCode byte
ControlCode represents a control code character. This is a character that is not printable and is used to control the terminal. This would be a character in the C0 or C1 set in the range of 0x00-0x1F and 0x80-0x9F.
func (ControlCode) Clone ¶
func (c ControlCode) Clone() Sequence
Clone returns a deep copy of the control code.
type CsiSequence ¶
type CsiSequence struct {
// Params contains the raw parameters of the sequence.
// This is a slice of integers, where each integer is a 32-bit integer
// containing the parameter value in the lower 31 bits and a flag in the
// most significant bit indicating whether there are more sub-parameters.
Params []Parameter
// Cmd contains the raw command of the sequence.
// The command is a 32-bit integer containing the CSI command byte in the
// lower 8 bits, the private marker in the next 8 bits, and the intermediate
// byte in the next 8 bits.
//
// CSI ? u
//
// Is represented as:
//
// 'u' | '?' << 8
Cmd Command
}
CsiSequence represents a control sequence introducer (CSI) sequence.
The sequence starts with a CSI sequence, CSI (0x9B) in a 8-bit environment or ESC [ (0x1B 0x5B) in a 7-bit environment, followed by any number of parameters in the range of 0x30-0x3F, then by any number of intermediate byte in the range of 0x20-0x2F, then finally with a single final byte in the range of 0x20-0x7E.
CSI P..P I..I F
See ECMA-48 § 5.4.
func (CsiSequence) Bytes ¶
func (s CsiSequence) Bytes() []byte
Bytes returns the byte representation of the sequence. The bytes will always be in the 7-bit format i.e (ESC [ P..P I..I F).
func (CsiSequence) Clone ¶
func (s CsiSequence) Clone() Sequence
Clone returns a deep copy of the CSI sequence.
func (CsiSequence) Command ¶
func (s CsiSequence) Command() int
Command returns the command byte of the CSI sequence.
func (CsiSequence) Intermediate ¶
func (s CsiSequence) Intermediate() int
Intermediate returns the intermediate byte of the CSI sequence. An intermediate byte is in the range of 0x20-0x2F. This includes these characters from ' ', '!', '"', '#', '$', '%', '&', ”', '(', ')', '*', '+', ',', '-', '.', '/'. Zero is returned if the sequence does not have an intermediate byte.
func (CsiSequence) Marker ¶
func (s CsiSequence) Marker() int
Marker returns the marker byte of the CSI sequence. This is always gonna be one of the following '<' '=' '>' '?' and in the range of 0x3C-0x3F. Zero is returned if the sequence does not have a marker.
func (CsiSequence) Param ¶
func (s CsiSequence) Param(i, def int) (int, bool)
Param is a helper that returns the parameter at the given index and falls back to the default value if the parameter is missing. If the index is out of bounds, it returns the default value and false.
func (CsiSequence) String ¶
func (s CsiSequence) String() string
String returns a string representation of the sequence. The string will always be in the 7-bit format i.e (ESC [ P..P I..I F).
type DECStatus ¶ added in v0.5.0
type DECStatus int
DECStatus represents a DEC terminal status report.
type DcsSequence ¶
type DcsSequence struct {
// Params contains the raw parameters of the sequence.
// This is a slice of integers, where each integer is a 32-bit integer
// containing the parameter value in the lower 31 bits and a flag in the
// most significant bit indicating whether there are more sub-parameters.
Params []Parameter
// Data contains the string raw data of the sequence.
// This is the data between the final byte and the escape sequence terminator.
Data []byte
// Cmd contains the raw command of the sequence.
// The command is a 32-bit integer containing the DCS command byte in the
// lower 8 bits, the private marker in the next 8 bits, and the intermediate
// byte in the next 8 bits.
//
// DCS > 0 ; 1 $ r <data> ST
//
// Is represented as:
//
// 'r' | '>' << 8 | '$' << 16
Cmd Command
}
DcsSequence represents a Device Control String (DCS) escape sequence.
The DCS sequence is used to send device control strings to the terminal. The sequence starts with the C1 control code character DCS (0x9B) or ESC P in 7-bit environments, followed by parameter bytes, intermediate bytes, a command byte, followed by data bytes, and ends with the C1 control code character ST (0x9C) or ESC \ in 7-bit environments.
This follows the parameter string format. See ECMA-48 § 5.4.1
func (DcsSequence) Bytes ¶
func (s DcsSequence) Bytes() []byte
Bytes returns the byte representation of the sequence. The bytes will always be in the 7-bit format i.e (ESC P p..p i..i F <data> ESC \).
func (DcsSequence) Clone ¶
func (s DcsSequence) Clone() Sequence
Clone returns a deep copy of the DCS sequence.
func (DcsSequence) Command ¶
func (s DcsSequence) Command() int
Command returns the command byte of the CSI sequence.
func (DcsSequence) Intermediate ¶
func (s DcsSequence) Intermediate() int
Intermediate returns the intermediate byte of the DCS sequence. An intermediate byte is in the range of 0x20-0x2F. This includes these characters from ' ', '!', '"', '#', '$', '%', '&', ”', '(', ')', '*', '+', ',', '-', '.', '/'. Zero is returned if the sequence does not have an intermediate byte.
func (DcsSequence) Marker ¶
func (s DcsSequence) Marker() int
Marker returns the marker byte of the DCS sequence. This is always gonna be one of the following '<' '=' '>' '?' and in the range of 0x3C-0x3F. Zero is returned if the sequence does not have a marker.
func (DcsSequence) Param ¶
func (s DcsSequence) Param(i, def int) (int, bool)
Param is a helper that returns the parameter at the given index and falls back to the default value if the parameter is missing. If the index is out of bounds, it returns the default value and false.
func (DcsSequence) Split ¶ added in v0.5.0
func (s DcsSequence) Split() []string
Split returns a slice of data split by the semicolon.
func (DcsSequence) String ¶
func (s DcsSequence) String() string
String returns a string representation of the sequence. The string will always be in the 7-bit format i.e (ESC P p..p i..i f <data> ESC \).
type EscSequence ¶
type EscSequence Command
EscSequence represents an escape sequence.
func (EscSequence) Clone ¶
func (e EscSequence) Clone() Sequence
Clone returns a deep copy of the escape sequence.
func (EscSequence) Command ¶
func (e EscSequence) Command() int
Command returns the command byte of the escape sequence.
func (EscSequence) Intermediate ¶
func (e EscSequence) Intermediate() int
Intermediate returns the intermediate byte of the escape sequence.
type ExtendedColor ¶
type ExtendedColor uint8
ExtendedColor is an ANSI 256 (8-bit) color with a value from 0 to 255.
type HexColorizer ¶ added in v0.5.0
HexColorizer is a color.Color that can be formatted as a hex string.
func (HexColorizer) String ¶ added in v0.5.0
func (h HexColorizer) String() string
String returns the color as a hex string. If the color is nil, an empty string is returned.
type Mode ¶ added in v0.4.0
type Mode interface {
Mode() int
}
Mode represents an interface for terminal modes. Modes can be set, reset, and requested.
type ModeSetting ¶ added in v0.5.0
type ModeSetting byte
ModeSetting represents a mode setting.
const ( ModeNotRecognized ModeSetting = iota ModeSet ModeReset ModePermanentlySet ModePermanentlyReset )
ModeSetting constants.
func (ModeSetting) IsNotRecognized ¶ added in v0.5.0
func (m ModeSetting) IsNotRecognized() bool
IsNotRecognized returns true if the mode is not recognized.
func (ModeSetting) IsPermanentlyReset ¶ added in v0.5.0
func (m ModeSetting) IsPermanentlyReset() bool
IsPermanentlyReset returns true if the mode is permanently reset.
func (ModeSetting) IsPermanentlySet ¶ added in v0.5.0
func (m ModeSetting) IsPermanentlySet() bool
IsPermanentlySet returns true if the mode is permanently set.
func (ModeSetting) IsReset ¶ added in v0.5.0
func (m ModeSetting) IsReset() bool
IsReset returns true if the mode is reset or permanently reset.
func (ModeSetting) IsSet ¶ added in v0.5.0
func (m ModeSetting) IsSet() bool
IsSet returns true if the mode is set or permanently set.
type OscSequence ¶
type OscSequence struct {
// Data contains the raw data of the sequence including the identifier
// command.
Data []byte
// Cmd contains the raw command of the sequence.
Cmd int
}
OscSequence represents an OSC sequence.
The sequence starts with a OSC sequence, OSC (0x9D) in a 8-bit environment or ESC ] (0x1B 0x5D) in a 7-bit environment, followed by positive integer identifier, then by arbitrary data terminated by a ST (0x9C) in a 8-bit environment, ESC \ (0x1B 0x5C) in a 7-bit environment, or BEL (0x07) for backwards compatibility.
OSC Ps ; Pt ST OSC Ps ; Pt BEL
See ECMA-48 § 5.7.
func (OscSequence) Bytes ¶
func (s OscSequence) Bytes() []byte
Bytes returns the byte representation of the OSC sequence. To be more compatible with different terminal, this will always return a 7-bit formatted sequence, terminated by BEL.
func (OscSequence) Clone ¶
func (o OscSequence) Clone() Sequence
Clone returns a deep copy of the OSC sequence.
func (OscSequence) Command ¶
func (o OscSequence) Command() int
Command returns the OSC command. This is always gonna be a positive integer that identifies the OSC sequence.
func (OscSequence) Split ¶ added in v0.5.0
func (o OscSequence) Split() []string
Split returns a slice of data split by the semicolon with the first element being the identifier command.
func (OscSequence) String ¶
func (s OscSequence) String() string
String returns the string representation of the OSC sequence. To be more compatible with different terminal, this will always return a 7-bit formatted sequence, terminated by BEL.
type Parameter ¶ added in v0.5.0
type Parameter int
Parameter represents a sequence parameter. Sequence parameters with sub-parameters are packed with the HasMoreFlag set. This is used to unpack the parameters from a CSI and DCS sequences.
func Param ¶ added in v0.2.0
Param returns a packed Parameter with the given parameter and whether this parameter has following sub-parameters.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a DEC ANSI compatible sequence parser.
It uses a state machine to parse ANSI escape sequences and control characters. The parser is designed to be used with a terminal emulator or similar application that needs to parse ANSI escape sequences and control characters. See package parser for more information.
func GetParser ¶ added in v0.3.1
func GetParser() *Parser
GetParser returns a parser from a sync pool.
func NewParser ¶
func NewParser(d ParserDispatcher) *Parser
NewParser returns a new parser with an optional ParserDispatcher. The Parser uses a default size of 32 for the parameters and 64KB for the data buffer. Use Parser.SetParamsSize and Parser.SetDataSize to set the size of the parameters and data buffer respectively.
func (*Parser) Advance ¶
Advance advances the parser using the given byte. It returns the action performed by the parser.
func (*Parser) Param ¶ added in v0.5.0
Param returns the parameter at the given index and falls back to the default value if the parameter is missing. If the index is out of bounds, it returns the default value and false.
func (*Parser) Parse ¶
Parse parses the given dispatcher and byte buffer. Deprecated: Loop over the buffer and call Parser.Advance instead.
func (*Parser) SetDataSize ¶ added in v0.5.0
SetDataSize sets the size of the data buffer. This is used when constructing OSC, DCS, SOS, PM, and APC sequences. If size is less than or equal to 0, the data buffer is unlimited and will grow as needed.
func (*Parser) SetDispatcher ¶ added in v0.5.0
func (p *Parser) SetDispatcher(d ParserDispatcher)
SetDispatcher sets the dispatcher function to call when a sequence is complete.
func (*Parser) SetParamsSize ¶ added in v0.5.0
SetParamsSize sets the size of the parameters buffer. This is used when constructing CSI and DCS sequences.
type ParserDispatcher ¶
type ParserDispatcher func(Sequence)
ParserDispatcher is a function that dispatches a sequence.
type PmSequence ¶
type PmSequence struct {
// Data contains the raw data of the sequence.
Data []byte
}
PmSequence represents a PM sequence.
func (PmSequence) Clone ¶
func (p PmSequence) Clone() Sequence
Clone returns a deep copy of the PM sequence.
type Sequence ¶
type Sequence interface {
// Clone returns a deep copy of the sequence.
Clone() Sequence
}
Sequence represents an ANSI sequence. This can be a control sequence, escape sequence, a printable character, etc. A Sequence can be one of the following types:
type SosSequence ¶
type SosSequence struct {
// Data contains the raw data of the sequence.
Data []byte
}
SosSequence represents a SOS sequence.
func (SosSequence) Clone ¶
func (s SosSequence) Clone() Sequence
Clone returns a deep copy of the SOS sequence.
type State ¶ added in v0.2.0
type State = byte
State represents the state of the ANSI escape sequence parser used by DecodeSequence.
ANSI escape sequence states used by DecodeSequence.
type Status ¶ added in v0.5.0
type Status interface {
// Status returns the status report identifier.
Status() int
}
Status represents a terminal status report.
type Style ¶
type Style []string
Style represents an ANSI SGR (Select Graphic Rendition) style.
func (Style) BackgroundColor ¶
BackgroundColor appends the background color style attribute to the style.
func (Style) CurlyUnderline ¶
CurlyUnderline appends the curly underline style attribute to the style. This is a convenience method for UnderlineStyle(CurlyUnderlineStyle).
func (Style) DashedUnderline ¶
DashedUnderline appends the dashed underline style attribute to the style. This is a convenience method for UnderlineStyle(DashedUnderlineStyle).
func (Style) DefaultBackgroundColor ¶
DefaultBackgroundColor appends the default background color style attribute to the style.
func (Style) DefaultForegroundColor ¶
DefaultForegroundColor appends the default foreground color style attribute to the style.
func (Style) DefaultUnderlineColor ¶
DefaultUnderlineColor appends the default underline color style attribute to the style.
func (Style) DottedUnderline ¶
DottedUnderline appends the dotted underline style attribute to the style. This is a convenience method for UnderlineStyle(DottedUnderlineStyle).
func (Style) DoubleUnderline ¶
DoubleUnderline appends the double underline style attribute to the style. This is a convenience method for UnderlineStyle(DoubleUnderlineStyle).
func (Style) ForegroundColor ¶
ForegroundColor appends the foreground color style attribute to the style.
func (Style) NoConceal ¶ added in v0.1.2
NoConceal appends the no conceal style attribute to the style.
func (Style) NoStrikethrough ¶
NoStrikethrough appends the no strikethrough style attribute to the style.
func (Style) NoUnderline ¶
NoUnderline appends the no underline style attribute to the style.
func (Style) NormalIntensity ¶
NormalIntensity appends the normal intensity style attribute to the style.
func (Style) RapidBlink ¶
RapidBlink appends the rapid blink style attribute to the style.
func (Style) Strikethrough ¶
Strikethrough appends the strikethrough style attribute to the style.
func (Style) String ¶
String returns the ANSI SGR (Select Graphic Rendition) style sequence for the given style.
func (Style) UnderlineColor ¶
UnderlineColor appends the underline color style attribute to the style.
func (Style) UnderlineStyle ¶ added in v0.3.0
func (s Style) UnderlineStyle(u UnderlineStyle) Style
UnderlineStyle appends the underline style attribute to the style.
type TrueColor ¶
type TrueColor uint32
TrueColor is a 24-bit color that can be used in the terminal. This can be used to represent RGB colors.
For example, the color red can be represented as:
TrueColor(0xff0000)
type UnderlineStyle ¶ added in v0.3.0
type UnderlineStyle = int
UnderlineStyle represents an ANSI SGR (Select Graphic Rendition) underline style.
const ( // NoUnderlineStyle is the default underline style. NoUnderlineStyle UnderlineStyle = iota // SingleUnderlineStyle is a single underline style. SingleUnderlineStyle // DoubleUnderlineStyle is a double underline style. DoubleUnderlineStyle // CurlyUnderlineStyle is a curly underline style. CurlyUnderlineStyle // DottedUnderlineStyle is a dotted underline style. DottedUnderlineStyle // DashedUnderlineStyle is a dashed underline style. DashedUnderlineStyle )
type XRGBAColorizer ¶ added in v0.5.0
XRGBAColorizer is a color.Color that can be formatted as an XParseColor rgba: string.
See: https://linux.die.net/man/3/xparsecolor
func (XRGBAColorizer) String ¶ added in v0.5.0
func (x XRGBAColorizer) String() string
String returns the color as an XParseColor rgba: string. If the color is nil, an empty string is returned.
type XRGBColorizer ¶ added in v0.5.0
XRGBColorizer is a color.Color that can be formatted as an XParseColor rgb: string.
See: https://linux.die.net/man/3/xparsecolor
func (XRGBColorizer) String ¶ added in v0.5.0
func (x XRGBColorizer) String() string
String returns the color as an XParseColor rgb: string. If the color is nil, an empty string is returned.
Source Files
¶
- ansi.go
- ascii.go
- background.go
- c0.go
- c1.go
- charset.go
- clipboard.go
- color.go
- csi.go
- ctrl.go
- cursor.go
- dcs.go
- doc.go
- focus.go
- hyperlink.go
- keypad.go
- kitty.go
- mode.go
- mouse.go
- notification.go
- osc.go
- params.go
- parser.go
- parser_decode.go
- parser_sync.go
- passthrough.go
- paste.go
- reset.go
- screen.go
- sequence.go
- sgr.go
- status.go
- style.go
- termcap.go
- title.go
- truncate.go
- util.go
- width.go
- wrap.go
- xterm.go