~mna/zzcsi

c4acc711cabb598d02f4a27ed9c97f1e79edca36 — Martin Angers 1 year, 2 months ago cbb75b1
more csi funcs
1 files changed, 265 insertions(+), 148 deletions(-)

M csi.go
M csi.go => csi.go +265 -148
@@ 119,67 119,67 @@ const (
	RstModeSendRecv   = 12
	RstModeNormNewln  = 20

	RstPrvModeNormCurKeys          = 1
	RstPrvModeVT52                 = 2
	RstPrvMode80Cols               = 3
	RstPrvModeJumpScrl             = 4
	RstPrvModeNormVid              = 5
	RstPrvModeNormCur              = 6
	RstPrvModeNoAutoWrap           = 7
	RstPrvModeNoAutoRep            = 8
	RstPrvModeNoX10Mous            = 9
	RstPrvModeNoToolbar            = 10
	RstPrvModeNoBlinkATT           = 12
	RstPrvModeNoBlink              = 13
	RstPrvModeNoXORBlink           = 14
	RstPrvModeNoPrnFF              = 18
	RstPrvModePrnScrlRegion        = 19
	RstPrvModeHideCur              = 25
	RstPrvModeHideScrlbar          = 30
	RstPrvModeNoFontShFn           = 35
	RstPrvModeDisallow80_132       = 40
	RstPrvModeNoMoreFix            = 41
	RstPrvModeNoNatlReplChSet      = 42
	RstPrvModeNoMargBl             = 44
	RstPrvModeNoRevWrap            = 45
	RstPrvModeNoLog                = 46
	RstPrvModeNormScrBuf           = 47
	RstPrvModeNumKeypad            = 66
	RstPrvModeBackArwDel           = 67
	RstPrvModeNoLeftRightMarg      = 69
	RstPrvModeNoSixelScrl          = 80
	RstPrvModeClrScr               = 95
	RstPrvModeNoX11MousBtn         = 1000
	RstPrvModeNoX11MousHilite      = 1001
	RstPrvModeNoX11MousCell        = 1002
	RstPrvModeNoX11MousAll         = 1003
	RstPrvModeNoFocus              = 1004
	RstPrvModeNoUTF8Mous           = 1005
	RstPrvModeNoSGRMous            = 1006
	RstPrvModeNoAltScrl            = 1007
	RstPrvModeNoScrlBotOnOut       = 1010
	RstPrvModeNoScrlBotOnKey       = 1011
	RstPrvModeNoURXVTMous          = 1015
	RstPrvModeNoMetaKey            = 1034
	RstPrvModeNoAltNumLock         = 1035
	RstPrvModeNoESCOnMeta          = 1036
	RstPrvModeVT220RemKeypad       = 1037
	RstPrvModeNoESCOnAlt           = 1039
	RstPrvModeNoKeepSel            = 1040
	RstPrvModeUsePriSel            = 1041
	RstPrvModeNoBlUrg              = 1042
	RstPrvModeNoPopOnBl            = 1043
	RstPrvModeNoSwitchAltScrBuf    = 1046
	RstPrvModeUseNormScrBuf        = 1047
	RstPrvModeRestoreCur           = 1048
	RstPrvModeRestoreCurNormScrBuf = 1049
	RstPrvModeTinfoTcap            = 1050
	RstPrvModeSun                  = 1051
	RstPrvModeHP                   = 1052
	RstPrvModeSCO                  = 1053
	RstPrvModeLegacyKeyb           = 1060
	RstPrvModeSunPCKeyb            = 1061
	RstPrvModeBrackPaste           = 2004
	RstPrvModeNormCurKeys       = 1
	RstPrvModeVT52              = 2
	RstPrvMode80Cols            = 3
	RstPrvModeJumpScrl          = 4
	RstPrvModeNormVid           = 5
	RstPrvModeNormCur           = 6
	RstPrvModeNoAutoWrap        = 7
	RstPrvModeNoAutoRep         = 8
	RstPrvModeNoX10Mous         = 9
	RstPrvModeNoToolbar         = 10
	RstPrvModeNoBlinkATT        = 12
	RstPrvModeNoBlink           = 13
	RstPrvModeNoXORBlink        = 14
	RstPrvModeNoPrnFF           = 18
	RstPrvModePrnScrlRegion     = 19
	RstPrvModeHideCur           = 25
	RstPrvModeHideScrlbar       = 30
	RstPrvModeNoFontShFn        = 35
	RstPrvModeDisallow80_132    = 40
	RstPrvModeNoMoreFix         = 41
	RstPrvModeNoNatlReplChSet   = 42
	RstPrvModeNoMargBl          = 44
	RstPrvModeNoRevWrap         = 45
	RstPrvModeNoLog             = 46
	RstPrvModeNormScrBuf        = 47
	RstPrvModeNumKeypad         = 66
	RstPrvModeBackArwDel        = 67
	RstPrvModeNoLeftRightMarg   = 69
	RstPrvModeNoSixelScrl       = 80
	RstPrvModeClrScr            = 95
	RstPrvModeNoX11MousBtn      = 1000
	RstPrvModeNoX11MousHilite   = 1001
	RstPrvModeNoX11MousCell     = 1002
	RstPrvModeNoX11MousAll      = 1003
	RstPrvModeNoFocus           = 1004
	RstPrvModeNoUTF8Mous        = 1005
	RstPrvModeNoSGRMous         = 1006
	RstPrvModeNoAltScrl         = 1007
	RstPrvModeNoScrlBotOnOut    = 1010
	RstPrvModeNoScrlBotOnKey    = 1011
	RstPrvModeNoURXVTMous       = 1015
	RstPrvModeNoMetaKey         = 1034
	RstPrvModeNoAltNumLock      = 1035
	RstPrvModeNoESCOnMeta       = 1036
	RstPrvModeVT220RemKeypad    = 1037
	RstPrvModeNoESCOnAlt        = 1039
	RstPrvModeNoKeepSel         = 1040
	RstPrvModeUsePriSel         = 1041
	RstPrvModeNoBlUrg           = 1042
	RstPrvModeNoPopOnBl         = 1043
	RstPrvModeNoSwitchAltScrBuf = 1046
	RstPrvModeUseNormScrBuf     = 1047
	RstPrvModeRstrCur           = 1048
	RstPrvModeRstrCurNormScrBuf = 1049
	RstPrvModeTinfoTcap         = 1050
	RstPrvModeSun               = 1051
	RstPrvModeHP                = 1052
	RstPrvModeSCO               = 1053
	RstPrvModeLegacyKeyb        = 1060
	RstPrvModeSunPCKeyb         = 1061
	RstPrvModeBrackPaste        = 2004

	ChAttrNorm             = 0
	ChAttrBold             = 1


@@ 267,6 267,60 @@ const (
	PtrModeHideIfNoMousTrack     = 1
	PtrModeAlwaysHideExceptLeave = 2
	PtrModeAlwaysHide            = 3

	SetConfLvlVT100 = 61
	SetConfLvlVT200 = 62
	SetConfLvlVT300 = 63
	SetConfLvlVT400 = 65
	SetConfLvlVT500 = 65
	SetConfLvl8Bit  = 0
	SetConfLvl7Bit  = 1
	SetConfLvl8bit2 = 2

	LdLEDsClrAll     = 0
	LdLEDsNumLock    = 1
	LdLEDsCapsLock   = 2
	LdLEDsScrlLock   = 3
	LdLEDsNoNumLock  = 21
	LdLEDsNoCapsLock = 22
	LdLEDsNoScrlLock = 23

	SetCurStyleBlinkBlock       = 0
	SetCurStyleBlinkBlockDef    = 1
	SetCurStyleNoBlinkBlock     = 2
	SetCurStyleBlinkUnderline   = 3
	SetCurStyleNoBlinkUnderline = 4
	SetCurStyleBlinkBar         = 5
	SetCurStyleNoBlinkBar       = 6

	ChProtAttrCanEraseDef = 0
	ChProtAttrCannotErase = 1
	ChProtAttrCanErase    = 2

	SetTitleModeSetLabelsHex  = 0
	SetTitleModeQryLabelsHex  = 1
	SetTitleModeSetLabelsUTF8 = 2
	SetTitleModeQryLabelsUTF8 = 3

	SetBlVolOff   = 0
	SetBlVolOff2  = 1
	SetBlVolLow   = 2
	SetBlVolLow2  = 3
	SetBlVolLow3  = 4
	SetBlVolHigh  = 5
	SetBlVolHigh2 = 6
	SetBlVolHigh3 = 7
	SetBlVolHigh4 = 8

	SetMargBlVolHigh  = 0
	SetMargBlVolHigh2 = 5
	SetMargBlVolHigh3 = 6
	SetMargBlVolHigh4 = 7
	SetMargBlVolHigh5 = 8
	SetMargBlVolOff   = 1
	SetMargBlVolLow   = 2
	SetMargBlVolLow2  = 3
	SetMargBlVolLow3  = 4
)

// CSI represents a Control Sequence Introducer function as supported


@@ 334,6 388,27 @@ const (
	DevStatDEC
	PtrMode
	SoftRst
	SetConfLvl
	ANSIMode
	DECPrvMode
	PushVidAttr
	LdLEDs
	SetCurStyle
	ChProtAttr
	PopVidAttr
	SetScrlRegn
	RstrDECPrvMode
	SetAttrRect
	SaveCur
	LeftRightMarg
	SaveDECPrvMode
	WinOps
	SetTitleMode
	SetBlVol
	RevAttrRect
	RstrCur
	SetMargBlVol
	CopyRect
)

var (


@@ 342,60 417,81 @@ var (
	// The CSI "Ps" (single number) parameter is encoded as "\x01" and the "Pm"
	// (multiple numbers separated by ;) is encoded as "\x02".

	insCh        = []byte("\x1b[\x01@")
	shLeft       = []byte("\x1b[\x01 @")
	curUp        = []byte("\x1b[\x01A")
	shRight      = []byte("\x1b[\x01 A")
	curDown      = []byte("\x1b[\x01B")
	curFwd       = []byte("\x1b[\x01C")
	curBwd       = []byte("\x1b[\x01D")
	curNextLn    = []byte("\x1b[\x01E")
	curPrevLn    = []byte("\x1b[\x01F")
	curColAbs    = []byte("\x1b[\x01G")
	curPos       = []byte("\x1b[\x01;\x01H")
	curFwdTab    = []byte("\x1b[\x01I")
	eraseScr     = []byte("\x1b[\x01J")
	selEraseScr  = []byte("\x1b[?\x01J")
	eraseLn      = []byte("\x1b[\x01K")
	selEraseLn   = []byte("\x1b[?\x01K")
	insLn        = []byte("\x1b[\x01L")
	delLn        = []byte("\x1b[\x01M")
	delCh        = []byte("\x1b[\x01P")
	scrlUp       = []byte("\x1b[\x01S")
	scrlDown     = []byte("\x1b[\x01T")
	rstTitleMode = []byte("\x1b[>\x02T")
	eraseCh      = []byte("\x1b[\x01X")
	curBwdTab    = []byte("\x1b[\x01Z")
	chColAbs     = []byte("\x1b[\x02`")
	chColRel     = []byte("\x1b[\x02a")
	repCh        = []byte("\x1b[\x01b")
	priDevAttr   = []byte("\x1b[\x01c")
	terDevAttr   = []byte("\x1b[=\x01c")
	secDevAttr   = []byte("\x1b[>\x01c")
	chLnAbs      = []byte("\x1b[\x02d")
	chLnRel      = []byte("\x1b[\x02e")
	chLnCol      = []byte("\x1b[\x01;\x01f")
	tabClr       = []byte("\x1b[\x01g")
	setMode      = []byte("\x1b[\x02h")
	setPrvMode   = []byte("\x1b[?\x02h")
	mediaCopy    = []byte("\x1b[\x02i")
	mediaCopyDEC = []byte("\x1b[?\x02i")
	rstMode      = []byte("\x1b[\x02l")
	rstPrvMode   = []byte("\x1b[?\x02l")
	chAttr       = []byte("\x1b[\x02m")
	chAttrFgIRGB = []byte("\x1b[38;2;\x01;\x01;\x01;\x01m")
	chAttrBgIRGB = []byte("\x1b[48;2;\x01;\x01;\x01;\x01m")
	chAttrFgIx   = []byte("\x1b[38;5;\x01m")
	chAttrBgIx   = []byte("\x1b[48;5;\x01m")
	chAttrFgRGB  = []byte("\x1b[38;2;\x01;\x01;\x01m")
	chAttrBgRGB  = []byte("\x1b[48;2;\x01;\x01;\x01m")
	setKeyMod    = []byte("\x1b[>\x01;\x01m")
	rstKeyMod    = []byte("\x1b[>\x01m")
	devStat      = []byte("\x1b[\x01n")
	disKeyMod    = []byte("\x1b[>\x02n")
	devStatDEC   = []byte("\x1b[?\x01n")
	ptrMode      = []byte("\x1b[>\x01p")
	softRst      = []byte("\x1b[!p")
	insCh          = []byte("\x1b[\x01@")
	shLeft         = []byte("\x1b[\x01 @")
	curUp          = []byte("\x1b[\x01A")
	shRight        = []byte("\x1b[\x01 A")
	curDown        = []byte("\x1b[\x01B")
	curFwd         = []byte("\x1b[\x01C")
	curBwd         = []byte("\x1b[\x01D")
	curNextLn      = []byte("\x1b[\x01E")
	curPrevLn      = []byte("\x1b[\x01F")
	curColAbs      = []byte("\x1b[\x01G")
	curPos         = []byte("\x1b[\x01;\x01H")
	curFwdTab      = []byte("\x1b[\x01I")
	eraseScr       = []byte("\x1b[\x01J")
	selEraseScr    = []byte("\x1b[?\x01J")
	eraseLn        = []byte("\x1b[\x01K")
	selEraseLn     = []byte("\x1b[?\x01K")
	insLn          = []byte("\x1b[\x01L")
	delLn          = []byte("\x1b[\x01M")
	delCh          = []byte("\x1b[\x01P")
	scrlUp         = []byte("\x1b[\x01S")
	scrlDown       = []byte("\x1b[\x01T")
	rstTitleMode   = []byte("\x1b[>\x02T")
	eraseCh        = []byte("\x1b[\x01X")
	curBwdTab      = []byte("\x1b[\x01Z")
	chColAbs       = []byte("\x1b[\x02`")
	chColRel       = []byte("\x1b[\x02a")
	repCh          = []byte("\x1b[\x01b")
	priDevAttr     = []byte("\x1b[\x01c")
	terDevAttr     = []byte("\x1b[=\x01c")
	secDevAttr     = []byte("\x1b[>\x01c")
	chLnAbs        = []byte("\x1b[\x02d")
	chLnRel        = []byte("\x1b[\x02e")
	chLnCol        = []byte("\x1b[\x01;\x01f")
	tabClr         = []byte("\x1b[\x01g")
	setMode        = []byte("\x1b[\x02h")
	setPrvMode     = []byte("\x1b[?\x02h")
	mediaCopy      = []byte("\x1b[\x02i")
	mediaCopyDEC   = []byte("\x1b[?\x02i")
	rstMode        = []byte("\x1b[\x02l")
	rstPrvMode     = []byte("\x1b[?\x02l")
	chAttr         = []byte("\x1b[\x02m")
	chAttrFgIRGB   = []byte("\x1b[38;2;\x01;\x01;\x01;\x01m")
	chAttrBgIRGB   = []byte("\x1b[48;2;\x01;\x01;\x01;\x01m")
	chAttrFgIx     = []byte("\x1b[38;5;\x01m")
	chAttrBgIx     = []byte("\x1b[48;5;\x01m")
	chAttrFgRGB    = []byte("\x1b[38;2;\x01;\x01;\x01m")
	chAttrBgRGB    = []byte("\x1b[48;2;\x01;\x01;\x01m")
	setKeyMod      = []byte("\x1b[>\x01;\x01m")
	rstKeyMod      = []byte("\x1b[>\x01m")
	devStat        = []byte("\x1b[\x01n")
	disKeyMod      = []byte("\x1b[>\x02n")
	devStatDEC     = []byte("\x1b[?\x01n")
	ptrMode        = []byte("\x1b[>\x01p")
	softRst        = []byte("\x1b[!p")
	setConfLvl     = []byte("\x1b[\x01;\x01\"p")
	ansiMode       = []byte("\x1b[\x01$p")
	decPrvMode     = []byte("\x1b[?\x01$p")
	pushVidAttr    = []byte("\x1b[\x02#p")
	ldLEDs         = []byte("\x1b[\x01q")
	setCurStyle    = []byte("\x1b[\x01 q")
	chProtAttr     = []byte("\x1b[\x01\"q")
	popVidAttr     = []byte("\x1b[#q")
	setScrlRegn    = []byte("\x1b[\x01;\x01r")
	rstrDECPrvMode = []byte("\x1b[?\x02r")
	setAttrRect    = []byte("\x1b[\x01;\x01;\x01;\x01;\x01$r")
	saveCur        = []byte("\x1b[s")
	leftRightMarg  = []byte("\x1b[\x01;\x01s")
	saveDECPrvMode = []byte("\x1b[?\x02s")
	winOps         = []byte("\x1b[\x01;\x01;\x01t")
	setTitleMode   = []byte("\x1b[>\x02t")
	setBlVol       = []byte("\x1b[\x01 t")
	revAttrRect    = []byte("\x1b[\x01;\x01;\x01;\x01;\x01$t")
	rstrCur        = []byte("\x1b[u")
	setMargBlVol   = []byte("\x1b[\x01 u")
	copyRect       = []byte("\x1b[\x01;\x01;\x01;\x01;\x01;\x01;\x01;\x01$v")
)

var csiSeqs = [...][]byte{


@@ 422,39 518,60 @@ var csiSeqs = [...][]byte{

	ScrlDown: scrlDown,

	RstTitleMode: rstTitleMode,
	EraseCh:      eraseCh,
	CurBwdTab:    curBwdTab,
	ChColAbs:     chColAbs,
	ChColRel:     chColRel,
	RepCh:        repCh,
	PriDevAttr:   priDevAttr,
	TerDevAttr:   terDevAttr,
	SecDevAttr:   secDevAttr,
	ChLnAbs:      chLnAbs,
	ChLnRel:      chLnRel,
	ChLnCol:      chLnCol,
	TabClr:       tabClr,
	SetMode:      setMode,
	SetPrvMode:   setPrvMode,
	MediaCopy:    mediaCopy,
	MediaCopyDEC: mediaCopyDEC,
	RstMode:      rstMode,
	RstPrvMode:   rstPrvMode,
	ChAttr:       chAttr,
	ChAttrFgIRGB: chAttrFgIRGB,
	ChAttrBgIRGB: chAttrBgIRGB,
	ChAttrFgIx:   chAttrFgIx,
	ChAttrBgIx:   chAttrBgIx,
	ChAttrFgRGB:  chAttrFgRGB,
	ChAttrBgRGB:  chAttrBgRGB,
	SetKeyMod:    setKeyMod,
	RstKeyMod:    rstKeyMod,
	DevStat:      devStat,
	DisKeyMod:    disKeyMod,
	DevStatDEC:   devStatDEC,
	PtrMode:      ptrMode,
	SoftRst:      softRst,
	RstTitleMode:   rstTitleMode,
	EraseCh:        eraseCh,
	CurBwdTab:      curBwdTab,
	ChColAbs:       chColAbs,
	ChColRel:       chColRel,
	RepCh:          repCh,
	PriDevAttr:     priDevAttr,
	TerDevAttr:     terDevAttr,
	SecDevAttr:     secDevAttr,
	ChLnAbs:        chLnAbs,
	ChLnRel:        chLnRel,
	ChLnCol:        chLnCol,
	TabClr:         tabClr,
	SetMode:        setMode,
	SetPrvMode:     setPrvMode,
	MediaCopy:      mediaCopy,
	MediaCopyDEC:   mediaCopyDEC,
	RstMode:        rstMode,
	RstPrvMode:     rstPrvMode,
	ChAttr:         chAttr,
	ChAttrFgIRGB:   chAttrFgIRGB,
	ChAttrBgIRGB:   chAttrBgIRGB,
	ChAttrFgIx:     chAttrFgIx,
	ChAttrBgIx:     chAttrBgIx,
	ChAttrFgRGB:    chAttrFgRGB,
	ChAttrBgRGB:    chAttrBgRGB,
	SetKeyMod:      setKeyMod,
	RstKeyMod:      rstKeyMod,
	DevStat:        devStat,
	DisKeyMod:      disKeyMod,
	DevStatDEC:     devStatDEC,
	PtrMode:        ptrMode,
	SoftRst:        softRst,
	SetConfLvl:     setConfLvl,
	ANSIMode:       ansiMode,
	DECPrvMode:     decPrvMode,
	PushVidAttr:    pushVidAttr,
	LdLEDs:         ldLEDs,
	SetCurStyle:    setCurStyle,
	ChProtAttr:     chProtAttr,
	PopVidAttr:     popVidAttr,
	SetScrlRegn:    setScrlRegn,
	RstrDECPrvMode: rstrDECPrvMode,
	SetAttrRect:    setAttrRect,
	SaveCur:        saveCur,
	LeftRightMarg:  leftRightMarg,
	SaveDECPrvMode: saveDECPrvMode,
	WinOps:         winOps,
	SetTitleMode:   setTitleMode,
	SetBlVol:       setBlVol,
	RevAttrRect:    revAttrRect,
	RstrCur:        rstrCur,
	SetMargBlVol:   setMargBlVol,
	CopyRect:       copyRect,
}

// Func returns the sequence of bytes to execute this CSI function with