Documentation ¶
Index ¶
- Constants
- Variables
- func Abs[T constraints.Signed | constraints.Float](x T) T
- func LowerBound(array []int, target int) int
- func NewStack[V comparable](max int) *stack[V]
- func RemoveIndex(s []int, index int) []int
- type ActOn
- type Cell
- func (c *Cell) Append(r rune)
- func (c *Cell) Clear()
- func (c *Cell) ContentsMatch(x Cell) bool
- func (c *Cell) Empty() bool
- func (c *Cell) GetContents() string
- func (c Cell) GetRenditions() Renditions
- func (c *Cell) GetWidth() int
- func (c Cell) IsBlank() bool
- func (c *Cell) IsDoubleWidth() bool
- func (c *Cell) IsDoubleWidthCont() bool
- func (c Cell) IsEarlyWrap() bool
- func (c *Cell) Reset2(attrs Cell)
- func (c *Cell) SetContents(chs []rune)
- func (c *Cell) SetDoubleWidth(value bool)
- func (c *Cell) SetDoubleWidthCont(value bool)
- func (c *Cell) SetEarlyWrap(v bool)
- func (c *Cell) SetRenditions(r Renditions)
- func (c *Cell) SetUnderline(underline bool)
- func (c Cell) String() string
- type CharsetState
- type ColMode
- type Color
- type CompatibilityLevel
- type Cursor
- type CursorKeyMode
- type CursorStyle
- type Damage
- type Display
- type Emulator
- func (emu *Emulator) Clone() *Emulator
- func (emu *Emulator) Equal(x *Emulator) bool
- func (emu *Emulator) EqualTrace(x *Emulator) bool
- func (emu *Emulator) GetCell(posY, posX int) Cell
- func (emu *Emulator) GetCellPtr(posY, posX int) *Cell
- func (emu *Emulator) GetCursorCol() int
- func (emu *Emulator) GetCursorRow() int
- func (emu *Emulator) GetFramebuffer() *Framebuffer
- func (emu *Emulator) GetHeight() int
- func (emu *Emulator) GetIconLabel() string
- func (emu *Emulator) GetParser() *Parser
- func (emu *Emulator) GetRenditions() (rnd Renditions)
- func (emu *Emulator) GetSaveLines() int
- func (emu *Emulator) GetWidth() int
- func (emu *Emulator) GetWindowTitle() string
- func (emu *Emulator) HandleLargeStream(seq string) (diff, remains string)
- func (emu *Emulator) HandleStream(seq string) (hds []*Handler, diff string)
- func (emu *Emulator) MoveCursor(posY, posX int)
- func (emu *Emulator) PrefixWindowTitle(prefix string)
- func (emu *Emulator) ReadOctetsToHost() string
- func (emu *Emulator) SetCursorVisible(visible bool)
- func (emu *Emulator) SetLastRows(x int)
- func (emu *Emulator) SetTerminalCaps(x map[int]string)
- func (emu *Emulator) Support(cap int) bool
- type FrameState
- type Framebuffer
- type Handler
- type KeypadMode
- type MouseTrackingEnc
- type MouseTrackingMode
- type MouseTrackingState
- type OriginMode
- type Parser
- type Point
- type Rect
- type Renditions
- func (rend *Renditions) ClearAttributes()
- func (r *Renditions) GetAttributes(attr charAttribute) (value, ok bool)
- func (rend *Renditions) SGR() string
- func (r *Renditions) SetAttributes(attr charAttribute, value bool)
- func (rend *Renditions) SetBackgroundColor(index int)
- func (rend *Renditions) SetBgColor(r, g, b int)
- func (rend *Renditions) SetFgColor(r, g, b int)
- func (rend *Renditions) SetForegroundColor(index int)
- type Resize
- type SavedCursor_DEC
- type SavedCursor_SCO
- type SelectSnapTo
- type UserByte
- type UserInput
Constants ¶
const ( ColorBlack = ColorValid + iota ColorMaroon // 1 ColorGreen // 2 ColorOlive // 3 ColorPurple // 5 ColorTeal // 6 ColorSilver // 7 ColorGray // 8 //90 ColorRed // 9 //91 ColorLime // 10 //92 ColorYellow // 11 //93 ColorBlue // 12 //94 ColorFuchsia // 13 //95 ColorAqua // 14 //96 ColorWhite // 15 //97 Color16 Color17 Color18 Color19 Color20 Color21 Color22 Color23 Color24 Color25 Color26 Color27 Color28 Color29 Color30 Color31 Color32 Color33 Color34 Color35 Color36 Color37 Color38 Color39 Color40 Color41 Color42 Color43 Color44 Color45 Color46 Color47 Color48 Color49 Color50 Color51 Color52 Color53 Color54 Color55 Color56 Color57 Color58 Color59 Color60 Color61 Color62 Color63 Color64 Color65 Color66 Color67 Color68 Color69 Color70 Color71 Color72 Color73 Color74 Color75 Color76 Color77 Color78 Color79 Color80 Color81 Color82 Color83 Color84 Color85 Color86 Color87 Color88 Color89 Color90 Color91 Color92 Color93 Color94 Color95 Color96 Color97 Color98 Color99 Color100 Color101 Color102 Color103 Color104 Color105 Color106 Color107 Color108 Color109 Color110 Color111 Color112 Color113 Color114 Color115 Color116 Color117 Color118 Color119 Color120 Color121 Color122 Color123 Color124 Color125 Color126 Color127 Color128 Color129 Color130 Color131 Color132 Color133 Color134 Color135 Color136 Color137 Color138 Color139 Color140 Color141 Color142 Color143 Color144 Color145 Color146 Color147 Color148 Color149 Color150 Color151 Color152 Color153 Color154 Color155 Color156 Color157 Color158 Color159 Color160 Color161 Color162 Color163 Color164 Color165 Color166 Color167 Color168 Color169 Color170 Color171 Color172 Color173 Color174 Color175 Color176 Color177 Color178 Color179 Color180 Color181 Color182 Color183 Color184 Color185 Color186 Color187 Color188 Color189 Color190 Color191 Color192 Color193 Color194 Color195 Color196 Color197 Color198 Color199 Color200 Color201 Color202 Color203 Color204 Color205 Color206 Color207 Color208 Color209 Color210 Color211 Color212 Color213 Color214 Color215 Color216 Color217 Color218 Color219 Color220 Color221 Color222 Color223 Color224 Color225 Color226 Color227 Color228 Color229 Color230 Color231 Color232 Color233 Color234 Color235 Color236 Color237 Color238 Color239 Color240 Color241 Color242 Color243 Color244 Color245 Color246 Color247 Color248 Color249 Color250 Color251 Color252 Color253 Color254 Color255 ColorAliceBlue ColorAntiqueWhite ColorAquaMarine ColorAzure ColorBeige ColorBisque ColorBlanchedAlmond ColorBlueViolet ColorBrown ColorBurlyWood ColorCadetBlue ColorChartreuse ColorChocolate ColorCoral ColorCornflowerBlue ColorCornsilk ColorCrimson ColorDarkBlue ColorDarkCyan ColorDarkGoldenrod ColorDarkGray ColorDarkGreen ColorDarkKhaki ColorDarkMagenta ColorDarkOliveGreen ColorDarkOrange ColorDarkOrchid ColorDarkRed ColorDarkSalmon ColorDarkSeaGreen ColorDarkSlateBlue ColorDarkSlateGray ColorDarkTurquoise ColorDarkViolet ColorDeepPink ColorDeepSkyBlue ColorDimGray ColorDodgerBlue ColorFireBrick ColorFloralWhite ColorForestGreen ColorGainsboro ColorGhostWhite ColorGold ColorGoldenrod ColorGreenYellow ColorHoneydew ColorHotPink ColorIndianRed ColorIndigo ColorIvory ColorKhaki ColorLavender ColorLavenderBlush ColorLawnGreen ColorLemonChiffon ColorLightBlue ColorLightCoral ColorLightCyan ColorLightGoldenrodYellow ColorLightGray ColorLightGreen ColorLightPink ColorLightSalmon ColorLightSeaGreen ColorLightSkyBlue ColorLightSlateGray ColorLightSteelBlue ColorLightYellow ColorLimeGreen ColorLinen ColorMediumAquamarine ColorMediumBlue ColorMediumOrchid ColorMediumPurple ColorMediumSeaGreen ColorMediumSlateBlue ColorMediumSpringGreen ColorMediumTurquoise ColorMediumVioletRed ColorMidnightBlue ColorMintCream ColorMistyRose ColorMoccasin ColorOldLace ColorOliveDrab ColorOrange ColorOrangeRed ColorOrchid ColorPaleGoldenrod ColorPaleGreen ColorPaleTurquoise ColorPaleVioletRed ColorPapayaWhip ColorPeachPuff ColorPeru ColorPink ColorPlum ColorPowderBlue ColorRebeccaPurple ColorRosyBrown ColorRoyalBlue ColorSaddleBrown ColorSalmon ColorSandyBrown ColorSeaGreen ColorSeashell ColorSienna ColorSkyblue ColorSlateBlue ColorSlateGray ColorSnow ColorSpringGreen ColorSteelBlue ColorTan ColorThistle ColorTomato ColorTurquoise ColorViolet ColorWheat ColorWhiteSmoke ColorYellowGreen )
Note that the order of these options is important -- it follows the definitions used by ECMA and XTerm. Hence any further named colors must begin at a value not less than 256.
const ( ColorGrey = ColorGray ColorDimGrey = ColorDimGray ColorDarkGrey = ColorDarkGray ColorDarkSlateGrey = ColorDarkSlateGray ColorLightGrey = ColorLightGray ColorLightSlateGrey = ColorLightSlateGray ColorSlateGrey = ColorSlateGray )
These are aliases for the color gray, because some of us spell it as grey.
const ( SaveLineUpperLimit = 50000 SaveLinesRowsOption = 60 )
const ( KITTY_KBD_DISAMBIGUATE = 0x01 KITTY_KBD_REPORT_EVENT = 0x02 KITTY_KBD_REPORT_ALTERNATE = 0x04 KITTY_KBD_REPORT_ALL = 0x08 KITTY_KBD_REPORT_ASSOCIATED = 0x10 KITTY_KBD_SUPPORTED = (KITTY_KBD_DISAMBIGUATE | KITTY_KBD_REPORT_EVENT | KITTY_KBD_REPORT_ALTERNATE | KITTY_KBD_REPORT_ALL | KITTY_KBD_REPORT_ASSOCIATED) KITTY_KBD_STACK_MAX = 9 )
const ( C0_BEL C0_CR C0_HT C0_SI C0_SO CSI_CBT CSI_CHA CSI_CHT CSI_CNL CSI_CPL CSI_CUB CSI_CUD CSI_CUF CSI_CUP CSI_CUU CSI_DCH CSI_DECIC CSI_DECDC CSI_privRM CSI_DECSCL CSI_DECSCUSR CSI_privSM CSI_DECRQM CSI_DECSTBM CSI_DECSTR CSI_ECMA48_SL CSI_ECMA48_SR CSI_FocusIn CSI_FocusOut CSI_DL CSI_DSR CSI_ECH CSI_ED CSI_EL CSI_HPA CSI_HPR CSI_ICH CSI_IL CSI_priDA CSI_REP CSI_RM CSI_secDA CSI_SD CSI_SM CSI_SU CSI_SCORC CSI_SLRM_SCOSC CSI_SGR CSI_TBC CSI_VPA CSI_VPR CSI_XTMODKEYS CSI_XTWINOPS CSI_U_QUERY CSI_U_SET CSI_U_PUSH CSI_U_POP CSI_MOUSETRACK DCS_DECRQSS DCS_XTGETTCAP ESC_BI ESC_DCS ESC_DECALN ESC_DECANM ESC_DECKPAM ESC_DECKPNM ESC_DECRC ESC_DECSC ESC_DOCS_UTF8 ESC_DOCS_ISO8859_1 ESC_FI ESC_HTS ESC_IND ESC_LS1R ESC_LS2 ESC_LS2R ESC_LS3 ESC_LS3R ESC_NEL ESC_RI ESC_RIS ESC_SS2 ESC_SS3 Graphemes OSC_4 OSC_52 OSC_0_1_2 OSC_10_11_12_17_19 OSC_112 OSC_8 VT52_EGM VT52_ID )
const ( USER_INPUT_GROUND = iota USER_INPUT_ESC USER_INPUT_SS3 )
const ( InputState_Normal = iota InputState_Escape InputState_Escape_VT52 InputState_Esc_Space InputState_Esc_Hash InputState_Esc_Pct InputState_Select_Charset InputState_CSI InputState_CSI_Priv InputState_CSI_Quote InputState_CSI_DblQuote InputState_CSI_Bang InputState_CSI_SPC InputState_CSI_GT InputState_CSI_LT InputState_CSI_Equal InputState_DCS InputState_DCS_Esc InputState_OSC InputState_OSC_Esc InputState_VT52_CUP_Arg1 InputState_VT52_CUP_Arg2 )
const ( Bold charAttribute = iota + 1 Faint Italic Underlined Blink RapidBlink // this one is added by SGR Inverse Invisible )
const ( ULS_NONE charAttribute = iota ULS_SINGLE ULS_DOUBLE ULS_CURLY ULS_DOTTED ULS_DASHED )
underline style
const ( // ColorReset is used to indicate that the color should use the // vanilla terminal colors. (Basically go back to the defaults.) ColorReset = ColorSpecial | iota )
Special colors.
const (
DEVICE_ID = "64;1;9;15;21;22c"
)
* 64 - VT420 family * 1 - 132 columns * 9 - National Replacement Character-sets * 15 - DEC technical set * 21 - horizontal scrolling * 22 - color
Variables ¶
var ( ErrEmptyStack = errors.New("empty stack") ErrLastItem = errors.New("last item in stack") )
var ColorNames = map[string]Color{}/* 146 elements not displayed */
ColorNames holds the written names of colors. Useful to present a list of recognized named colors.
var ColorValues = map[Color]int32{}/* 379 elements not displayed */
ColorValues maps color constants to their RGB values.
Functions ¶
func Abs ¶
func Abs[T constraints.Signed | constraints.Float](x T) T
func LowerBound ¶
func RemoveIndex ¶
Types ¶
type Cell ¶
type Cell struct {
// contains filtered or unexported fields
}
contents saved in strings.Builder * Don't set the fields directly * * Cell is comparable
func (*Cell) ContentsMatch ¶
func (*Cell) GetContents ¶
func (Cell) GetRenditions ¶
func (c Cell) GetRenditions() Renditions
func (*Cell) IsDoubleWidth ¶
func (*Cell) IsDoubleWidthCont ¶
func (Cell) IsEarlyWrap ¶
func (*Cell) SetDoubleWidth ¶
func (*Cell) SetDoubleWidthCont ¶
func (*Cell) SetEarlyWrap ¶
func (*Cell) SetRenditions ¶
func (c *Cell) SetRenditions(r Renditions)
func (*Cell) SetUnderline ¶
type CharsetState ¶
type CharsetState struct {
// contains filtered or unexported fields
}
only in vtMode, charset is enabled, otherwise UTF-8 is choosed.
func (*CharsetState) Equal ¶
func (cs *CharsetState) Equal(x *CharsetState) bool
type ColMode ¶
type ColMode uint8
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
type Color ¶
type Color uint64
https://github.com/gdamore/tcell/blob/master/color.go https://www.ditig.com/256-colors-cheat-sheet
Color represents a color. The low numeric values are the same as used by ECMA-48, and beyond that XTerm. A 24-bit RGB value may be used by adding in the ColorIsRGB flag. For Color names we use the W3C approved color names.
We use a 64-bit integer to allow future expansion if we want to add an 8-bit alpha, while still leaving us some room for extra options.
Note that on various terminals colors may be approximated however, or not supported at all. If no suitable representation for a color is known, the library will simply not set any color, deferring to whatever default attributes the terminal uses.
const ( // ColorDefault is used to leave the Color unchanged from whatever // system or terminal default may exist. It's also the zero value. ColorDefault Color = 0 // ColorValid is used to indicate the color value is actually // valid (initialized). This is useful to permit the zero value // to be treated as the default. ColorValid Color = 1 << 32 // ColorIsRGB is used to indicate that the numeric value is not // a known color constant, but rather an RGB value. The lower // order 3 bytes are RGB. ColorIsRGB Color = 1 << 33 // ColorSpecial is a flag used to indicate that the values have // special meaning, and live outside of the color space(s). ColorSpecial Color = 1 << 34 )
func GetColor ¶
GetColor creates a Color from a color name (W3C name). A hex value may be supplied as a string in the format "#ffffff".
func NewHexColor ¶
NewHexColor returns a color using the given 24-bit RGB value.
func NewRGBColor ¶
NewRGBColor returns a new color with the given red, green, and blue values. Each value must be represented in the range 0-255.
func PaletteColor ¶
PaletteColor creates a color based on the palette index.
func (Color) Hex ¶
Hex returns the color's hexadecimal RGB 24-bit value with each component consisting of a single byte, ala R << 16 | G << 8 | B. If the color is unknown or unset, -1 is returned.
func (Color) RGB ¶
RGB returns the red, green, and blue components of the color, with each component represented as a value 0-255. In the event that the color cannot be broken up (not set usually), -1 is returned for each value.
func (Color) String ¶
return the string representation according to RGB specification as per XParseColor. for example: Color(0xBA55D3).String() returns "rgb:0x00BA/0x0055/0x00D3", for invalid Color, return empty string.
type CompatibilityLevel ¶
type CompatibilityLevel uint8
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( CompatLevel_Unused CompatibilityLevel = iota CompatLevel_VT52 CompatLevel_VT100 CompatLevel_VT400 )
type CursorKeyMode ¶
type CursorKeyMode uint8
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( CursorKeyMode_ANSI CursorKeyMode = iota CursorKeyMode_Application )
type CursorStyle ¶
type CursorStyle uint
const ( CursorStyle_Hidden CursorStyle = iota CursorStyle_FillBlock CursorStyle_HollowBlock )
const ( CursorStyle_BlinkBlock CursorStyle = iota CursorStyle_SteadyBlock CursorStyle_BlinkUnderline CursorStyle_SteadyUnderline CursorStyle_BlinkBar CursorStyle_SteadyBar CursorStyle_Invalid )
Set cursor style (DECSCUSR), VT520.
Ps = 0 ⇒ blinking block. Ps = 1 ⇒ blinking block (default). Ps = 2 ⇒ steady block. Ps = 3 ⇒ blinking underline. Ps = 4 ⇒ steady underline. Ps = 5 ⇒ blinking bar, xterm. Ps = 6 ⇒ steady bar, xterm.
type Display ¶
type Display struct {
// contains filtered or unexported fields
}
* The following are some interesting questions I asked several month ago. As I know terminfo * and terminal better, the answter is more clear and confident than before. * * do we need to package the the terminfo DB into application? * - yes, mosh-server depends on ncurses-terminfo-base and ncurses-libs * how to read terminfo DB? through ncurses lib or directly? * - yes the answer is read through tcell. * how to operate terminal? through direct escape sequence or through terminfo DB? * how to replace the following functions? setupterm(), tigetnum(), tigetstr(), tigetflag()
func NewDisplay ¶
https://github.com/gdamore/tcell the successor of termbox-go https://cs.opensource.google/go/x/term/+/master:README.md apk add mandoc man-pages ncurses-doc apk add ncurses-terminfo apk add ncurses-terminfo-base apk add ncurses https://ishuah.com/2021/03/10/build-a-terminal-emulator-in-100-lines-of-go/
use TERM environment var to initialize display, if useEnvironment is true.
func (*Display) NewFrame ¶
compare two terminals and generate mix (grapheme and control sequence) sequence to rebuild the new terminal from the old one.
- initialized: if false, it will redraw the whole terminal, otherwise only changed part. - oldE: the old terminal state. - newE: the new terminal state.
type Emulator ¶
type Emulator struct {
// contains filtered or unexported fields
}
// Terminal state - N.B.: keep resetTerminal () in sync with this!
func NewEmulator3 ¶
func (*Emulator) EqualTrace ¶
TODO remove this after finish test.
func (*Emulator) GetCellPtr ¶
func (*Emulator) GetFramebuffer ¶
func (emu *Emulator) GetFramebuffer() *Framebuffer
func (*Emulator) GetIconLabel ¶
func (*Emulator) GetRenditions ¶
func (emu *Emulator) GetRenditions() (rnd Renditions)
func (*Emulator) GetSaveLines ¶
func (*Emulator) GetWindowTitle ¶
func (*Emulator) HandleLargeStream ¶
parse and handle the stream together. counting occupied rows, if ring buffer is full, pause the process and return the remains stream.
func (*Emulator) HandleStream ¶
parse and handle the stream together.
func (*Emulator) MoveCursor ¶
move cursor to specified position
func (*Emulator) PrefixWindowTitle ¶
func (*Emulator) ReadOctetsToHost ¶
return the terminal feedback, clean feedback buffer.
func (*Emulator) SetCursorVisible ¶
func (*Emulator) SetLastRows ¶
func (*Emulator) SetTerminalCaps ¶
type FrameState ¶
type FrameState struct {
// contains filtered or unexported fields
}
type Framebuffer ¶
type Framebuffer struct {
// contains filtered or unexported fields
}
support both (scrollable) normal screen buffer and alternate screen buffer
func NewFramebuffer2 ¶
func NewFramebuffer2(nCols, nRows int) Framebuffer
create a framebuffer, with zero saveLines.
func NewFramebuffer3 ¶
func NewFramebuffer3(nCols, nRows, saveLines int) (fb Framebuffer, marginTop int, marginBottom int)
create a framebuffer according to the specified nCols, nRows and saveLines. saveLines: for alternate screen buffer default is 0, for normal screen buffer the default is 500, max 50000 return the framebuffer and external marginTop,marginBottom.
func (*Framebuffer) Equal ¶
func (fb *Framebuffer) Equal(x *Framebuffer) bool
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the outcome of parsering input, it can be used to perform control sequence on emulator.
type KeypadMode ¶
type KeypadMode uint8
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( KeypadMode_Normal KeypadMode = iota KeypadMode_Application )
type MouseTrackingEnc ¶
type MouseTrackingEnc uint16
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( MouseTrackingEnc_Default MouseTrackingEnc = 0 MouseTrackingEnc_UTF8 MouseTrackingEnc = 1005 MouseTrackingEnc_SGR MouseTrackingEnc = 1006 MouseTrackingEnc_URXVT MouseTrackingEnc = 1015 )
type MouseTrackingMode ¶
type MouseTrackingMode uint16
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( MouseTrackingMode_Disable MouseTrackingMode = 0 MouseTrackingMode_X10_Compat MouseTrackingMode = 9 MouseTrackingMode_VT200 MouseTrackingMode = 1000 MouseTrackingMode_VT200_HighLight MouseTrackingMode = 1001 MouseTrackingMode_VT200_ButtonEvent MouseTrackingMode = 1002 MouseTrackingMode_VT200_AnyEvent MouseTrackingMode = 1003 )
type MouseTrackingState ¶
type MouseTrackingState struct {
// contains filtered or unexported fields
}
check resetScreen() for default value
type OriginMode ¶
type OriginMode uint8
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( OriginMode_Absolute OriginMode = iota OriginMode_ScrollingRegion )
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) ProcessInput ¶
process each rune. must apply the UTF-8 decoder to the incoming byte stream before interpreting any control characters. ref: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
func (*Parser) ProcessStream ¶
func (*Parser) ResetInput ¶
func (p *Parser) ResetInput()
type Renditions ¶
type Renditions struct {
// contains filtered or unexported fields
}
Renditions determines the foreground and background color and character attribute. it is comparable. default background/foreground is ColorDefault
func NewRenditions ¶
func NewRenditions(attribute int) (rend Renditions)
create rendition based on colorAttr parameter. This method can only be used to set 16-color set.
func (*Renditions) ClearAttributes ¶
func (rend *Renditions) ClearAttributes()
func (*Renditions) GetAttributes ¶
func (r *Renditions) GetAttributes(attr charAttribute) (value, ok bool)
func (*Renditions) SGR ¶
func (rend *Renditions) SGR() string
generate SGR sequence based on Renditions CSI Pm m Character Attributes (SGR). https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ https://sw.kovidgoyal.net/kitty/underlines/
func (*Renditions) SetAttributes ¶
func (r *Renditions) SetAttributes(attr charAttribute, value bool)
func (*Renditions) SetBackgroundColor ¶
func (rend *Renditions) SetBackgroundColor(index int)
set the ANSI background indexed color. The index start from 0. represent ANSI standard color.
func (*Renditions) SetBgColor ¶
func (rend *Renditions) SetBgColor(r, g, b int)
set RGB background color
func (*Renditions) SetFgColor ¶
func (rend *Renditions) SetFgColor(r, g, b int)
set RGB foreground color
func (*Renditions) SetForegroundColor ¶
func (rend *Renditions) SetForegroundColor(index int)
set the ANSI foreground indexed color. The index start from 0. represent ANSI standard color.
type SavedCursor_DEC ¶
type SavedCursor_DEC struct { SavedCursor_SCO // contains filtered or unexported fields }
type SavedCursor_SCO ¶
type SavedCursor_SCO struct {
// contains filtered or unexported fields
}
type SelectSnapTo ¶
type SelectSnapTo uint8
type DrawState struct { width int height int cursorCol int cursorRow int cursorColor Color combiningCharCol int combiningCharRow int defaultTabs bool tabs []bool scrollingRegionTopRow int scrollingRegionBottomRow int renditions Renditions save SavedCursor // public fields NextPrintWillWrap bool // DEC private mode OriginMode bool // two possiible value: ScrollingRegion(true), Absolute(false) AutoWrapMode bool // true/false CursorVisible bool // true/false ReverseVideo bool // two possible value: Reverse(true), Normal(false) BracketedPaste bool // true/false MouseReportingMode int // replace it with MouseTrackingMode MouseFocusEvent bool // replace it with MouseTrackingState.focusEventMode MouseAlternateScroll bool // rename to altScrollMode MouseEncodingMode int // replace it with MouseTrackingEnc ApplicationModeCursorKeys bool // =cursorKeyMode two possible value : Application(true), ANSI(false) mouseTrk MouseTrackingState altSendsEscape bool // ANSI mode keyboardLocked bool InsertMode bool // true/false localEcho bool autoNewlineMode bool // added for vt400 compatibility compatLevel CompatibilityLevel // VT52, VT100, VT400 altScreenBufferMode bool // Alternate Screen Buffer support: default false columnMode ColMode // column mode 80 or 132, just for compatibility horizMarginMode bool // left and right margins support hMargin int // left margins nColsEff int // right margins bkspSendsDel bool // backspace send delete savedCursorSCO SavedCursorSCO // SCO console cursor state }
const ( SelectSnapTo_Char SelectSnapTo = iota SelectSnapTo_Word SelectSnapTo_Line SelectSnapTo_COUNT )