Correct handling of DeviceAttributes request (#139)

This commit is contained in:
rrrooommmaaa 2019-01-10 20:55:17 +00:00 committed by Liam Galvin
parent 89eea0921d
commit c674cbd5c7
1 changed files with 20 additions and 4 deletions

View File

@ -108,12 +108,28 @@ func csiHandler(pty chan rune, terminal *Terminal) error {
func csiSendDeviceAttributesHandler(params []string, intermediate string, terminal *Terminal) error { func csiSendDeviceAttributesHandler(params []string, intermediate string, terminal *Terminal) error {
if len(params) > 0 && len(params[0]) > 0 && params[0][0] == '>' { // secondary // we are VT100
_ = terminal.Write([]byte("\x1b[0;0;0c")) // report VT100 // for DA1 we'll respond 1;2
return nil // for DA2 we'll respond 0;0;0
response := "1;2"
if len(params) > 0 {
param, err := strconv.Atoi(params[0])
if err != nil {
return fmt.Errorf("Invalid parameter in DA request: %s", params[0])
} }
return fmt.Errorf("Unsupported SDA identifier") if param > 0 {
// DA2
response = "0;0;0"
}
}
_ = terminal.Write([]byte("\x1b[?" + response + "c"))
return nil
} }
func csiDeviceStatusReportHandler(params []string, intermediate string, terminal *Terminal) error { func csiDeviceStatusReportHandler(params []string, intermediate string, terminal *Terminal) error {