Source File
screen.go
Belonging Package
github.com/charmbracelet/x/ansi
package ansiimport ()// 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//// See: https://vt100.net/docs/vt510-rm/ED.htmlfunc ( int) string {var stringif > 0 {= strconv.Itoa()}return "\x1b[" + + "J"}// ED is an alias for [EraseDisplay].func ( int) string {return EraseDisplay()}// EraseDisplay constants.// These are the possible values for the EraseDisplay function.const (EraseScreenBelow = "\x1b[J"EraseScreenAbove = "\x1b[1J"EraseEntireScreen = "\x1b[2J"EraseEntireDisplay = "\x1b[3J")// 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//// See: https://vt100.net/docs/vt510-rm/EL.htmlfunc ( int) string {var stringif > 0 {= strconv.Itoa()}return "\x1b[" + + "K"}// EL is an alias for [EraseLine].func ( int) string {return EraseLine()}// EraseLine constants.// These are the possible values for the EraseLine function.const (EraseLineRight = "\x1b[K"EraseLineLeft = "\x1b[1K"EraseEntireLine = "\x1b[2K")// ScrollUp (SU) scrolls the screen up n lines. New lines are added at the// bottom of the screen.//// CSI Pn S//// See: https://vt100.net/docs/vt510-rm/SU.htmlfunc ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "S"}// PanDown is an alias for [ScrollUp].func ( int) string {return ScrollUp()}// SU is an alias for [ScrollUp].func ( int) string {return ScrollUp()}// ScrollDown (SD) scrolls the screen down n lines. New lines are added at the// top of the screen.//// CSI Pn T//// See: https://vt100.net/docs/vt510-rm/SD.htmlfunc ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "T"}// PanUp is an alias for [ScrollDown].func ( int) string {return ScrollDown()}// SD is an alias for [ScrollDown].func ( int) string {return ScrollDown()}// InsertLine (IL) inserts n blank lines at the current cursor position.// Existing lines are moved down.//// CSI Pn L//// See: https://vt100.net/docs/vt510-rm/IL.htmlfunc ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "L"}// IL is an alias for [InsertLine].func ( int) string {return InsertLine()}// DeleteLine (DL) deletes n lines at the current cursor position. Existing// lines are moved up.//// CSI Pn M//// See: https://vt100.net/docs/vt510-rm/DL.htmlfunc ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "M"}// DL is an alias for [DeleteLine].func ( int) string {return DeleteLine()}// 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//// See: https://vt100.net/docs/vt510-rm/DECSTBM.htmlfunc (, int) string {var , stringif > 0 {= strconv.Itoa()}if > 0 {= strconv.Itoa()}return "\x1b[" + + ";" + + "r"}// DECSTBM is an alias for [SetTopBottomMargins].func (, int) string {return SetTopBottomMargins(, )}// 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//// See: https://vt100.net/docs/vt510-rm/DECSLRM.htmlfunc (, int) string {var , stringif > 0 {= strconv.Itoa()}if > 0 {= strconv.Itoa()}return "\x1b[" + + ";" + + "s"}// DECSLRM is an alias for [SetLeftRightMargins].func (, int) string {return SetLeftRightMargins(, )}// 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 (, int) string {if < 0 {= 0}if < 0 {= 0}return "\x1b[" + strconv.Itoa() + ";" + strconv.Itoa() + "r"}// 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 @//// See: https://vt100.net/docs/vt510-rm/ICH.htmlfunc ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "@"}// ICH is an alias for [InsertCharacter].func ( int) string {return InsertCharacter()}// 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//// See: https://vt100.net/docs/vt510-rm/DCH.htmlfunc ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "P"}// DCH is an alias for [DeleteCharacter].func ( int) string {return DeleteCharacter()}// SetTabEvery8Columns (DECST8C) sets the tab stops at every 8 columns.//// CSI ? 5 W//// See: https://vt100.net/docs/vt510-rm/DECST8C.htmlconst (SetTabEvery8Columns = "\x1b[?5W"DECST8C = SetTabEvery8Columns)// 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.htmlconst HorizontalTabSet = "\x1bH"// 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//// See: https://vt100.net/docs/vt510-rm/TBC.htmlfunc ( int) string {var stringif > 0 {= strconv.Itoa()}return "\x1b[" + + "g"}// TBC is an alias for [TabClear].func ( int) string {return TabClear()}// 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//// See: https://vt100.net/docs/vt510-rm/DECRQPSR.htmlfunc ( int) string {var stringif > 0 {= strconv.Itoa()}return "\x1b[" + + "$w"}// DECRQPSR is an alias for [RequestPresentationStateReport].func ( int) string {return RequestPresentationStateReport()}// 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.//// See: https://vt100.net/docs/vt510-rm/DECTABSR.htmlfunc ( ...int) string {var []string //nolint:preallocfor , := range {= append(, strconv.Itoa())}return "\x1bP2$u" + strings.Join(, "/") + "\x1b\\"}// DECTABSR is an alias for [TabStopReport].func ( ...int) string {return TabStopReport(...)}// 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.//// See: https://vt100.net/docs/vt510-rm/DECCIR.htmlfunc ( ...int) string {var []string //nolint:preallocfor , := range {= append(, strconv.Itoa())}return "\x1bP1$u" + strings.Join(, ";") + "\x1b\\"}// DECCIR is an alias for [CursorInformationReport].func ( ...int) string {return CursorInformationReport(...)}// 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 ( int) string {var stringif > 1 {= strconv.Itoa()}return "\x1b[" + + "b"}// REP is an alias for [RepeatPreviousCharacter].func ( int) string {return RepeatPreviousCharacter()}
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)