Skip to content

Commit

Permalink
Correct backspace and delete key mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Oct 22, 2020
1 parent ae77130 commit a1d92e7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,11 @@ const (
KeyNull = keyNUL
KeyBreak = keyETX
KeyEnter = keyCR
KeyBackspace = keyBS
KeyBackspace = keyDEL
KeyTab = keyHT
KeySpace = keySP
KeyEsc = keyESC
KeyEscape = keyESC
KeyDelete = keyDEL

KeyCtrlAt = keyNUL // ctrl+@
KeyCtrlA = keySOH
Expand Down Expand Up @@ -185,6 +184,7 @@ const (
KeyEnd
KeyPgUp
KeyPgDown
KeyDelete
)

// Mapping for control keys to friendly consts.
Expand All @@ -197,8 +197,8 @@ var keyNames = map[int]string{
keyENQ: "ctrl+e",
keyACK: "ctrl+f",
keyBEL: "ctrl+g",
keyBS: "backspace", // also ctrl+h
keyHT: "tab", // also ctrl+i
keyBS: "ctrl+h",
keyHT: "tab", // also ctrl+i
keyLF: "ctrl+j",
keyVT: "ctrl+k",
keyFF: "ctrl+l",
Expand All @@ -222,7 +222,7 @@ var keyNames = map[int]string{
keyRS: "ctrl+^",
keyUS: "ctrl+_",
keySP: "space",
keyDEL: "delete",
keyDEL: "backspace",

KeyRune: "rune",
KeyUp: "up",
Expand All @@ -248,8 +248,9 @@ var sequences = map[string]KeyType{
// sequences.
var hexes = map[string]Key{
"1b5b5a": {Type: KeyShiftTab},
"1b5b337e": {Type: KeyDelete},
"1b0d": {Type: KeyEnter, Alt: true},
"1b7f": {Type: KeyDelete, Alt: true},
"1b7f": {Type: KeyBackspace, Alt: true},
"1b5b48": {Type: KeyHome},
"1b5b377e": {Type: KeyHome}, // urxvt
"1b5b313b3348": {Type: KeyHome, Alt: true},
Expand Down

0 comments on commit a1d92e7

Please sign in to comment.