mirror of https://github.com/liamg/aminal.git
ESC key for vi (#227)
* #225 ESC press doesn't work as expected under vi * fix: BEL OSC terminator for Windows * bug fix: correcte DA2 handling
This commit is contained in:
parent
0ac44844ad
commit
d91a17c74b
|
@ -196,17 +196,9 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
|
||||||
gui.terminal.Write([]byte(fmt.Sprintf("\x1b[6;%s~", modStr)))
|
gui.terminal.Write([]byte(fmt.Sprintf("\x1b[6;%s~", modStr)))
|
||||||
}
|
}
|
||||||
case glfw.KeyEscape:
|
case glfw.KeyEscape:
|
||||||
if gui.terminal.IsApplicationCursorKeysModeEnabled() {
|
|
||||||
gui.terminal.Write([]byte{
|
gui.terminal.Write([]byte{
|
||||||
0x1b,
|
0x1b,
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
gui.terminal.Write([]byte{
|
|
||||||
0x1b,
|
|
||||||
'[',
|
|
||||||
0x1b,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case glfw.KeyTab:
|
case glfw.KeyTab:
|
||||||
gui.terminal.Write([]byte{
|
gui.terminal.Write([]byte{
|
||||||
0x09,
|
0x09,
|
||||||
|
|
|
@ -223,7 +223,7 @@ func NewPty(x, y int) (pty Pty, err error) {
|
||||||
innerOutPipe: outputWriteSide,
|
innerOutPipe: outputWriteSide,
|
||||||
hcon: uintptr(hc),
|
hcon: uintptr(hc),
|
||||||
platformDependentSettings: PlatformDependentSettings{
|
platformDependentSettings: PlatformDependentSettings{
|
||||||
OSCTerminators: map[rune]struct{}{0x00: {}},
|
OSCTerminators: map[rune]struct{}{0x00: {}, 0x07: {}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,25 +114,16 @@ func csiHandler(pty chan rune, terminal *Terminal) error {
|
||||||
func csiSendDeviceAttributesHandler(params []string, terminal *Terminal) error {
|
func csiSendDeviceAttributesHandler(params []string, terminal *Terminal) error {
|
||||||
|
|
||||||
// we are VT100
|
// we are VT100
|
||||||
// for DA1 we'll respond 1;2
|
// for DA1 we'll respond ?1;2
|
||||||
// for DA2 we'll respond 0;0;0
|
// for DA2 we'll respond >0;0;0
|
||||||
|
|
||||||
response := "1;2"
|
response := "?1;2"
|
||||||
|
|
||||||
if len(params) > 0 {
|
if len(params) > 0 && len(params[0]) > 0 && params[0][0] == '>' {
|
||||||
param, err := strconv.Atoi(params[0])
|
response = ">0;0;0"
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Invalid parameter in DA request: %s", params[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if param > 0 {
|
_ = terminal.Write([]byte("\x1b[" + response + "c"))
|
||||||
// DA2
|
|
||||||
response = "0;0;0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = terminal.Write([]byte("\x1b[?" + response + "c"))
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue