Skip to content

Commit

Permalink
fix(key): recover the insert key
Browse files Browse the repository at this point in the history
We started supporting insert in #418, but then accidentally
removed it during a rebase in #396. Oops.
  • Loading branch information
knz authored and muesli committed Oct 7, 2022
1 parent f406999 commit 0e76ba1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ var sequences = map[string]Key{
// Miscellaneous keys
"\x1b[Z": {Type: KeyShiftTab},

"\x1b[2~": {Type: KeyInsert},
"\x1b[3;2~": {Type: KeyInsert, Alt: true},
"\x1b\x1b[2~": {Type: KeyInsert, Alt: true}, // urxvt

"\x1b[3~": {Type: KeyDelete},
"\x1b[3;3~": {Type: KeyDelete, Alt: true},
"\x1b\x1b[3~": {Type: KeyDelete, Alt: true}, // urxvt
Expand Down
8 changes: 8 additions & 0 deletions key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ func TestReadInput(t *testing.T) {
},
},
},
{"insert",
[]byte{'\x1b', '[', '2', '~'},
[]Msg{
KeyMsg{
Type: KeyInsert,
},
},
},
{"alt+ctrl+a",
[]byte{'\x1b', byte(keySOH)},
[]Msg{
Expand Down

0 comments on commit 0e76ba1

Please sign in to comment.