fix: Xterm Send Device Attributes (Primary DA) (#607)

This commit is contained in:
hstyi
2025-05-30 10:44:53 +08:00
committed by GitHub
parent 61bc905727
commit c08712d79b
2 changed files with 47 additions and 1 deletions

View File

@@ -360,8 +360,9 @@ class ControlSequenceIntroducerProcessor(terminal: Terminal, reader: TerminalRea
}
}
// TODO Send Device Attributes (Primary DA).
// Send Device Attributes (Primary DA).
'c' -> {
sendDeviceAttributes()
}
// CSI Ps M Delete Ps Line(s) (default = 1) (DL).
@@ -505,6 +506,22 @@ class ControlSequenceIntroducerProcessor(terminal: Terminal, reader: TerminalRea
}
private fun sendDeviceAttributes() {
assertEventDispatchThread()
if (!terminalModel.hasData(DataKey.TerminalWriter)) {
return
}
val writer = terminalModel.getData(DataKey.TerminalWriter)
// VT102_RESPONSE
val bytes = "${ControlCharacters.ESC}[?6c".toByteArray(writer.getCharset())
writer.write(TerminalWriter.WriteRequest.fromBytes(bytes))
}
/**
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-?-Pm-h.1D0E
*/