Merge pull request #107 from liamg/alt-backspace

add alt backspace
This commit is contained in:
Liam Galvin 2018-12-03 14:14:12 +00:00 committed by GitHub
commit a28ac522ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -227,7 +227,11 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
}) })
} }
case glfw.KeyBackspace: case glfw.KeyBackspace:
gui.terminal.Write([]byte{0x08}) if modsPressed(mods, glfw.ModAlt) {
gui.terminal.Write([]byte{0x17}) // ctrl-w/delete word
} else {
gui.terminal.Write([]byte{0x8})
}
case glfw.KeyUp: case glfw.KeyUp:
if modStr != "" { if modStr != "" {
gui.terminal.Write([]byte(fmt.Sprintf("\x1b[1;%sA", modStr))) gui.terminal.Write([]byte(fmt.Sprintf("\x1b[1;%sA", modStr)))