mirror of https://github.com/liamg/aminal.git
correct handling (ignoring) Privacy Message sequence (ESC ^)
This commit is contained in:
parent
4f308bdbd8
commit
15f5601c04
|
@ -17,6 +17,7 @@ var ansiSequenceMap = map[rune]escapeSequenceHandler{
|
||||||
'P': sixelHandler,
|
'P': sixelHandler,
|
||||||
'c': risHandler, //RIS
|
'c': risHandler, //RIS
|
||||||
'#': screenStateHandler,
|
'#': screenStateHandler,
|
||||||
|
'^': privacyMessageHandler,
|
||||||
'(': scs0Handler, // select character set into G0
|
'(': scs0Handler, // select character set into G0
|
||||||
')': scs1Handler, // select character set into G1
|
')': scs1Handler, // select character set into G1
|
||||||
'*': swallowHandler(1), // character set bullshit
|
'*': swallowHandler(1), // character set bullshit
|
||||||
|
@ -104,3 +105,24 @@ func tabSetHandler(pty chan rune, terminal *Terminal) error {
|
||||||
terminal.terminalState.TabSetAtCursor()
|
terminal.terminalState.TabSetAtCursor()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func privacyMessageHandler(pty chan rune, terminal *Terminal) error {
|
||||||
|
// Handler should lock the terminal if there will be write operations to any data read by the renderer
|
||||||
|
// terminal.Lock()
|
||||||
|
// defer terminal.Unlock()
|
||||||
|
|
||||||
|
isEscaped := false
|
||||||
|
for {
|
||||||
|
b := <-pty
|
||||||
|
if b == 0x18 /*CAN*/ || b == 0x1a /*SUB*/ || (b == 0x5c /*backslash*/ && isEscaped) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if isEscaped {
|
||||||
|
isEscaped = false
|
||||||
|
} else if b == 0x1b {
|
||||||
|
isEscaped = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue