pansi

package
Version: v0.0.0-...-af25313 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2016 License: MIT Imports: 3 Imported by: 0

README

Note: Quotes indicate raw text

Bash

  • ^[[?1034h
  • "bash-3.2$ "

Nano

  • ^[[?1049h
    • Save cursor as in DECSC and use Alternate Screen Buffer, clearing it first.
    • (This may be disabled by the titeInhibit resource).
    • This combines the effects of the 1 0 4 7 and 1 0 4 8 modes.
    • Use this with terminfo-based applications rather than the 4 7 mode.
  • ^[[1;54r
    • DECSTBM
    • Set top and bottom lines of a window
  • ^[(B
    • setusg0
    • Set United States G0 character set
  • ^[[m
    • SGR0
    • Turn off character attributes
  • ^[[4l
    • Reset Mode: Replace Mode
  • ^[[?7h
    • Wraparound Mode (DECAWM)
  • ^[[?12l
    • Reset Mode: Send/receive (SRM)
  • ^[[?25h
    • Show Cursor (DECTCEM)
  • ^[[?1h
    • Application Cursor Keys (DECCKM)
  • ^[=
    • Application Keypad (DECKPAM)
  • ^[[?1h
    • Application Cursor Keys (DECCKM)
  • ^[=
  • ^[[?1h
    • Application Cursor Keys (DECCKM)
  • ^[=
    • Application Keypad (DECKPAM)
  • ^[[39;49m
    • Set foreground color to default (original).
    • Set background color to default (original).
  • ^[[39;49m
    • Set foreground color to default (original).
    • Set background color to default (original).
  • ^[(B
    • setusg0
    • Set United States G0 character set
  • ^[[m
    • SGR0
    • Turn off character attributes
  • ^[[H
    • Move cursor to upper left corner cursorhome
  • ^[[2J
    • Erase display
  • ^[(B
    • setusg0
    • Set United States G0 character set
  • ^[[0;7m
    • Turn off character attributes
    • Inverse
  • " GNU nano 2.0.6 New Buffer "
  • ^[[53;1H
    • Cursor Position [row;column]
  • "^G"
  • ^[(B
    • setusg0
    • Set United States G0 character set
  • ^[[m
    • SGR0
    • Turn off character attributes
  • " Get Help"
  • ^[[53;35H
    • Cursor Position [row;column]
  • ^[(B
  • ^[[0;7m
  • "^O"
  • ^[(B
  • ^[[m
  • " WriteOut"
  • ^[[53;69H
  • ^[(B
  • ^[[0;7m^R
  • ^[(B
  • ^[[m Read File
  • ^[[53;103H
  • ^[(B
  • ^[[0;7m^Y
  • ^[(B
  • ^[[m
  • " Prev Page"
  • ^[[53;137H
  • ^[(B
  • ^[[0;7m^K
  • ^[(B
  • ^[[m Cut Text
  • ^[[53;171H
  • ^[(B
  • ^[[0;7m^C
  • ^[(B
  • ^[[m
  • " Cur Pos"^M
  • ^[[54d
  • ^[(B
  • ^[[0;7m^X
  • ^[(B
  • ^[[m
  • " Exit"
  • ^[[54;35H
  • ^[(B
  • ^[[0;7m^J
  • ^[(B
  • ^[[m
  • " Justify"
  • ^[[54;69H
  • ^[(B
  • ^[[0;7m^W
  • ^[(B
  • ^[[m
  • " Where Is"
  • ^[[54;103H
  • ^[(B
  • ^[[0;7m^V
  • ^[(B
  • ^[[m Next Page
  • ^[[54;137H
  • ^[(B
  • ^[[0;7m^U
  • ^[(B
  • ^[[m UnCut Text
  • ^[[54;171H
  • ^[(B
  • ^[[0;7m^T
  • ^[(B
  • ^[[m To Spell
  • ^[[3d
  • ^[[53d
  • ^[[J
  • ^[[54;204H
  • ^[[54;1H
  • ^[[?1049l
  • ^[[?1l
  • ^[>

Documentation

Overview

generated by generate.py; DO NOT EDIT

pansi provides functions to aid in parsing ansi escape code All rules for parsing are pulled from: http://ascii-table.com/ansi-escape-sequences.php http://www.vt100.net/emu/dec_ansi_parser

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

func Feed

func Feed(b byte)

func FeedRune

func FeedRune(r rune)

Types

type AnsiEscapeCode

type AnsiEscapeCode struct {
	Type   AnsiEscapeType
	Values []int
}

func Parse

func Parse(s string) *AnsiEscapeCode

func Result

func Result() *AnsiEscapeCode

type AnsiEscapeType

type AnsiEscapeType int
const (
	Invalid                       AnsiEscapeType = iota
	CBT, CursorBackwardTabulation AnsiEscapeType = iota, iota

	CHA, CursorHorizontalAbsolute AnsiEscapeType = iota, iota

	CHT, CursorHorizontalForwardTabulation AnsiEscapeType = iota, iota

	CNL, CursorNextLine AnsiEscapeType = iota, iota

	CPL, CursorPreviousLine AnsiEscapeType = iota, iota

	CPR, CursorPositionReport AnsiEscapeType = iota, iota

	CRM, ShowControlCharacterMode AnsiEscapeType = iota, iota

	CUB, CursorBackward AnsiEscapeType = iota, iota

	CUD, CursorDown AnsiEscapeType = iota, iota

	CUF, CursorForward AnsiEscapeType = iota, iota

	CUP, CursorPosition AnsiEscapeType = iota, iota

	CUU, CursorUp AnsiEscapeType = iota, iota

	DA1, PrimaryDeviceAttributes AnsiEscapeType = iota, iota

	DA2, SecondaryDeviceAttributes AnsiEscapeType = iota, iota

	DA3, TertiaryDeviceAttributes AnsiEscapeType = iota, iota

	DCH, DeleteCharacter AnsiEscapeType = iota, iota

	DECAAM, SetResetAutoAnswerbackMode AnsiEscapeType = iota, iota

	DECALN, ScreenAlignmentPattern AnsiEscapeType = iota, iota

	DECANM, ANSIMode AnsiEscapeType = iota, iota

	DECARM, AutorepeatMode AnsiEscapeType = iota, iota

	DECARSM, SetResetAutoResizeMode AnsiEscapeType = iota, iota

	DECAUPSS, AssigningUserPreferredSupplementalSets AnsiEscapeType = iota, iota

	DECAWM, AutowrapMode AnsiEscapeType = iota, iota

	DECBI, BackIndex AnsiEscapeType = iota, iota

	DECBKM, BackarrowKeyMode AnsiEscapeType = iota, iota

	DECCANSM, ConcealAnswerbackMessageMode AnsiEscapeType = iota, iota

	DECCAPSLK, CapsLockMode AnsiEscapeType = iota, iota

	DECCARA, ChangeAttributesinRectangularArea AnsiEscapeType = iota, iota

	DECCIR, CursorInformationReportTerminaltoHost AnsiEscapeType = iota, iota

	DECCKD, CopyKeyDefault AnsiEscapeType = iota, iota

	DECCKM, CursorKeysMode AnsiEscapeType = iota, iota

	DECCKSR, MemoryChecksumReport AnsiEscapeType = iota, iota

	DECCRA, CopyRectangularArea AnsiEscapeType = iota, iota

	DECCRTSM, SetResetCRTSaveMode AnsiEscapeType = iota, iota

	DECDC, DeleteColumn AnsiEscapeType = iota, iota

	DECDHL, DoubleWidthDoubleHeightLine AnsiEscapeType = iota, iota

	DECDLD, DynamicallyRedefinableCharacterSets AnsiEscapeType = iota, iota

	DECDMAC, DefineMacro AnsiEscapeType = iota, iota

	DECDWL, DoubleWidthSingleHeightLine AnsiEscapeType = iota, iota

	DECEKBD, ExtendedKeyboardReport AnsiEscapeType = iota, iota

	DECELF, EnableLocalFunctions AnsiEscapeType = iota, iota

	DECERA, EraseRectangularArea AnsiEscapeType = iota, iota

	DECESKM, EnableSecondaryKeyboardLanguageMode AnsiEscapeType = iota, iota

	DECFI, ForwardIndex AnsiEscapeType = iota, iota

	DECFNK, FunctionKey AnsiEscapeType = iota, iota

	DECFRA, FillRectangularArea AnsiEscapeType = iota, iota

	DECHDPXM, SetResetHalfDuplexMode AnsiEscapeType = iota, iota

	DECHEBM, HebrewNAKeyboardMapping AnsiEscapeType = iota, iota

	DECHEM, HebrewEncodingMode AnsiEscapeType = iota, iota

	DECIC, InsertColumn AnsiEscapeType = iota, iota

	DECINVM, InvokeMacro AnsiEscapeType = iota, iota

	DECIPEM, EnterReturnfromIBMProPrinterEmulationMode AnsiEscapeType = iota, iota

	DECKBD, KeyboardLanguageSelection AnsiEscapeType = iota, iota

	DECKBUM, TypewriterorDataProcessingKeys AnsiEscapeType = iota, iota

	DECKLHIM, KeyboardLEDsHostIndicatorMode AnsiEscapeType = iota, iota

	DECKPAM, KeypadApplicationMode AnsiEscapeType = iota, iota

	DECKPM, KeyPositionMode AnsiEscapeType = iota, iota

	DECKPNM, KeypadNumericMode AnsiEscapeType = iota, iota

	DECLANS, LoadAnswerbackMessage AnsiEscapeType = iota, iota

	DECLBAN, LoadBannerMessage AnsiEscapeType = iota, iota

	DECLFKC, LocalFunctionKeyControl AnsiEscapeType = iota, iota

	DECLL, LoadLEDs AnsiEscapeType = iota, iota

	DECLRMM, LeftRightMarginMode AnsiEscapeType = iota, iota

	DECLTOD, LoadTimeofDay AnsiEscapeType = iota, iota

	DECMCM, SetResetModemControlMode AnsiEscapeType = iota, iota

	DECMSR, MacroSpaceReport AnsiEscapeType = iota, iota

	DECNAKB, GreekNAKeyboardMapping AnsiEscapeType = iota, iota

	DECNCSM, SetResetNoClearingScreenOnColumnChange AnsiEscapeType = iota, iota

	DECNKM, NumericKeypadMode AnsiEscapeType = iota, iota

	DECNRCM, NationalReplacementCharacterSetMode AnsiEscapeType = iota, iota

	DECNULM, SetResetIgnoringNullMode AnsiEscapeType = iota, iota

	DECNUMLK, NumLockMode AnsiEscapeType = iota, iota

	DECOM, OriginMode AnsiEscapeType = iota, iota

	DECPAK, ProgramAlphanumericKey AnsiEscapeType = iota, iota

	DECPCCM, PageCursorCouplingMode AnsiEscapeType = iota, iota

	DECPCTERM, EnterExitPCTermorScancodeMode AnsiEscapeType = iota, iota

	DECPEX, PrinterExtentMode AnsiEscapeType = iota, iota

	DECPFF, PrintFormFeedMode AnsiEscapeType = iota, iota

	DECPFK, ProgramFunctionKey AnsiEscapeType = iota, iota

	DECPKA, ProgramKeyAction AnsiEscapeType = iota, iota

	DECPKFMR, ProgramKeyFreeMemoryReport AnsiEscapeType = iota, iota

	DECRARA, ReverseAttributesinRectangularArea AnsiEscapeType = iota, iota

	DECRC, RestoreCursor AnsiEscapeType = iota, iota

	DECRLCM, RighttoLeftCopy AnsiEscapeType = iota, iota

	DECRLM, CursorRighttoLeftMode AnsiEscapeType = iota, iota

	DECRPAK, ReportAllModifiersAlphanumericKeyState AnsiEscapeType = iota, iota

	DECRPDE, ReportDisplayedExtent AnsiEscapeType = iota, iota

	DECRPFK, ReportFunctionKeyDefinition AnsiEscapeType = iota, iota

	DECRPKT, ReportKeyType AnsiEscapeType = iota, iota

	DECRPM, ReportModeTerminalToHost AnsiEscapeType = iota, iota

	DECRPSS, ReportSelectionorSetting AnsiEscapeType = iota, iota

	DECRPTUI, ReportTerminalUnitID AnsiEscapeType = iota, iota

	DECRQCRA, RequestChecksumofRectangularArea AnsiEscapeType = iota, iota

	DECRQDE, RequestDisplayedExtent AnsiEscapeType = iota, iota

	DECRQKD, RequestKeyDefinition AnsiEscapeType = iota, iota

	DECRQKT, KeyTypeInquiry AnsiEscapeType = iota, iota

	DECRQM, RequestModeHostToTerminal AnsiEscapeType = iota, iota

	DECRQPKFM, ProgramKeyFreeMemoryInquiry AnsiEscapeType = iota, iota

	DECRQPSR, RequestPresentationStateReport AnsiEscapeType = iota, iota

	DECRQSS, RequestSelectionorSetting AnsiEscapeType = iota, iota

	DECRQTSR, RequestTerminalStateReport AnsiEscapeType = iota, iota

	DECRQUPSS, UserPreferredSupplementalSet AnsiEscapeType = iota, iota

	DECRSPS, RestorePresentationState AnsiEscapeType = iota, iota

	DECRSTS, RestoreTerminalState AnsiEscapeType = iota, iota

	DECSACE, SelectAttributeChangeExtent AnsiEscapeType = iota, iota

	DECSASD, SelectActiveStatusDisplay AnsiEscapeType = iota, iota

	DECSCA, SelectCharacterProtectionAttribute AnsiEscapeType = iota, iota

	DECSCLM, ScrollingMode AnsiEscapeType = iota, iota

	DECSCL, SelectConformanceLevel AnsiEscapeType = iota, iota

	DECSCNM, ScreenModeLightorDarkScreen AnsiEscapeType = iota, iota

	DECSCPP, Select80or132ColumnsperPage AnsiEscapeType = iota, iota

	DECSCP, SelectCommunicationPort AnsiEscapeType = iota, iota

	DECSCS, SelectCommunicationSpeed AnsiEscapeType = iota, iota

	DECSCUSR, SetCursorStyle AnsiEscapeType = iota, iota

	DECSC, SaveCursor AnsiEscapeType = iota, iota

	DECSDDT, SelectDisconnectDelayTime AnsiEscapeType = iota, iota

	DECSDPT, SelectDigitalPrintedDataType AnsiEscapeType = iota, iota

	DECSED, SelectiveEraseDisplay AnsiEscapeType = iota, iota

	DECSEL, SelectiveEraseLine AnsiEscapeType = iota, iota

	DECSERA, SelectiveEraseRectangularArea AnsiEscapeType = iota, iota

	DECSFC, SelectFlowControl AnsiEscapeType = iota, iota

	DECSKCV, SetKeyClickVolume AnsiEscapeType = iota, iota

	DECSLCK, SetLockKeyStyle AnsiEscapeType = iota, iota

	DECSLPP, SetLinesPerPage AnsiEscapeType = iota, iota

	DECSLRM, SetLeftandRightMargins AnsiEscapeType = iota, iota

	DECSMBV, SetMarginBellVolume AnsiEscapeType = iota, iota

	DECSMKR, SelectModifierKeyReporting AnsiEscapeType = iota, iota

	DECSNLS, SetLinesPerScreen AnsiEscapeType = iota, iota

	DECSPPCS, SelectProPrinterCharacterSet AnsiEscapeType = iota, iota

	DECSPP, SetPortParameter AnsiEscapeType = iota, iota

	DECSPRTT, SelectPrinterType AnsiEscapeType = iota, iota

	DECSRC, SecureResetConfirmation AnsiEscapeType = iota, iota

	DECSRFR, SelectRefreshRate AnsiEscapeType = iota, iota

	DECSR, SecureReset AnsiEscapeType = iota, iota

	DECSSCLS, SetScrollSpeed AnsiEscapeType = iota, iota

	DECSSDT, SelectStatusDisplayLineType AnsiEscapeType = iota, iota

	DECSSL, SelectSetUpLanguage AnsiEscapeType = iota, iota

	DECST8C, SetTabatEvery8Columns AnsiEscapeType = iota, iota

	DECSTBM, SetTopAndBottomMargins AnsiEscapeType = iota, iota

	DECSTRL, SetTransmitRateLimit AnsiEscapeType = iota, iota

	DECSTR, SoftTerminalReset AnsiEscapeType = iota, iota

	DECSWBV, SetWarningBellVolume AnsiEscapeType = iota, iota

	DECSWL, SingleWidthSingleHeightLine AnsiEscapeType = iota, iota

	DECTABSR, TabStopReport AnsiEscapeType = iota, iota

	DECTCEM, TextCursorEnableMode AnsiEscapeType = iota, iota

	DECTID, SelectTerminalID AnsiEscapeType = iota, iota

	DECTME, TerminalModeEmulation AnsiEscapeType = iota, iota

	DECTSR, TerminalStateReport AnsiEscapeType = iota, iota

	DECTST, InvokeConfidenceTest AnsiEscapeType = iota, iota

	DECUDK, UserDefinedKeys AnsiEscapeType = iota, iota

	DECVCCM, VerticalCursorCouplingMode AnsiEscapeType = iota, iota

	DECXCPR, ExtendedCursorPosition AnsiEscapeType = iota, iota

	DECXRLM, TransmitRateLimiting AnsiEscapeType = iota, iota

	DL, DeleteLine AnsiEscapeType = iota, iota

	DSR, DeviceStatusReports AnsiEscapeType = iota, iota

	ECH, EraseCharacter AnsiEscapeType = iota, iota

	ED, EraseDisplay AnsiEscapeType = iota, iota

	EL, EraseLine AnsiEscapeType = iota, iota

	HPA, HorizontalPositionAbsolute AnsiEscapeType = iota, iota

	HPR, HorizontalPositionRelative AnsiEscapeType = iota, iota

	HTS, HorizontalTabSet AnsiEscapeType = iota, iota

	HVP, HorizontalandVerticalPosition AnsiEscapeType = iota, iota

	ICH, InsertCharacter AnsiEscapeType = iota, iota

	IL, InsertLine AnsiEscapeType = iota, iota

	IND, Index AnsiEscapeType = iota, iota

	RI, ReverseIndex AnsiEscapeType = iota, iota

	IRM, InsertReplaceMode AnsiEscapeType = iota, iota

	KAM, KeyboardActionMode AnsiEscapeType = iota, iota

	LNM, LineFeedNewLineMode AnsiEscapeType = iota, iota

	LS, LockingShift AnsiEscapeType = iota, iota

	MC, MediaCopy AnsiEscapeType = iota, iota

	NEL, NextLine AnsiEscapeType = iota, iota

	NP, NextPage AnsiEscapeType = iota, iota

	PPA, PagePositionAbsolute AnsiEscapeType = iota, iota

	PPB, PagePositionBackward AnsiEscapeType = iota, iota

	PPR, PagePositionRelative AnsiEscapeType = iota, iota

	PP, PrecedingPage AnsiEscapeType = iota, iota

	RIS, ResettoInitialState AnsiEscapeType = iota, iota

	RM, ResetMode AnsiEscapeType = iota, iota

	S7C1T, SendC1ControlCharactertoHost AnsiEscapeType = iota, iota

	S8C1T, SendC1ControlCharactertotheHost AnsiEscapeType = iota, iota

	SCODFK, DefineFunctionKey AnsiEscapeType = iota, iota

	SCORC, RestoreSavedCursorPosition AnsiEscapeType = iota, iota

	SCOSC, SaveCurrentCursorPosition AnsiEscapeType = iota, iota

	SCS, SelectCharacterSet AnsiEscapeType = iota, iota

	SD, PanUp AnsiEscapeType = iota, iota

	SGR, SelectGraphicRendition AnsiEscapeType = iota, iota

	SM, SetMode AnsiEscapeType = iota, iota

	SRM, LocalEchoSendReceiveMode AnsiEscapeType = iota, iota

	SS, SingleShifts AnsiEscapeType = iota, iota

	SU, PanDown AnsiEscapeType = iota, iota

	TBC, TabClear AnsiEscapeType = iota, iota

	VPA, VerticalLinePositionAbsolute AnsiEscapeType = iota, iota

	VPR, VerticalPositionRelative AnsiEscapeType = iota, iota
)

func (AnsiEscapeType) String

func (i AnsiEscapeType) String() string

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

func NewLexer

func NewLexer() Lexer

func (*Lexer) Clear

func (l *Lexer) Clear()

func (*Lexer) Feed

func (l *Lexer) Feed(b byte)

func (*Lexer) FeedRune

func (l *Lexer) FeedRune(r rune)

func (*Lexer) Parse

func (l *Lexer) Parse(s string) *AnsiEscapeCode

func (*Lexer) Result

func (l *Lexer) Result() *AnsiEscapeCode

func (*Lexer) State

func (l *Lexer) State() State

type Rule

type Rule struct {
	Start, End byte
	Transition Transition
	State      State
}

type State

type State int
const (
	Ground State = iota
	OscString
	SosPmApcString

	Escape
	EscapeIntermediate

	CsiEntry
	CsiIgnore
	CsiParam
	CsiIntermediate

	DcsEntry
	DcsParam
	DcsIgnore
	DcsPassthrough
	DcsIntermediate
)

type Transition

type Transition func(*Lexer, byte) *AnsiEscapeCode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL