Skip to content

Commit

Permalink
Support the insert key
Browse files Browse the repository at this point in the history
This can be used in e.g. textarea / textinput to enable "overwrite
mode".
  • Loading branch information
knz authored and muesli committed Sep 27, 2022
1 parent cb4ff09 commit 2fe97e0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const (
KeyPgUp
KeyPgDown
KeyDelete
KeyInsert
KeySpace
KeyCtrlUp
KeyCtrlDown
Expand Down Expand Up @@ -284,6 +285,7 @@ var keyNames = map[KeyType]string{
KeyPgUp: "pgup",
KeyPgDown: "pgdown",
KeyDelete: "delete",
KeyInsert: "insert",
KeyCtrlUp: "ctrl+up",
KeyCtrlDown: "ctrl+down",
KeyCtrlRight: "ctrl+right",
Expand Down Expand Up @@ -376,6 +378,8 @@ var sequences = map[string]Key{

// Miscellaneous keys
"\x1b[Z": {Type: KeyShiftTab},
"\x1b[2~": {Type: KeyInsert},
"\x1b[2;3~": {Type: KeyInsert, Alt: true},
"\x1b[3~": {Type: KeyDelete},
"\x1b[3;3~": {Type: KeyDelete, Alt: true},
"\x1b[1~": {Type: KeyHome},
Expand All @@ -388,6 +392,7 @@ var sequences = map[string]Key{
"\x1b[6;3~": {Type: KeyPgDown, Alt: true},
"\x1b[7~": {Type: KeyHome}, // urxvt
"\x1b[8~": {Type: KeyEnd}, // urxvt
"\x1b\x1b[2~": {Type: KeyInsert, Alt: true}, // urxvt
"\x1b\x1b[3~": {Type: KeyDelete, Alt: true}, // urxvt
"\x1b\x1b[5~": {Type: KeyPgUp, Alt: true}, // urxvt
"\x1b\x1b[6~": {Type: KeyPgDown, Alt: true}, // urxvt
Expand Down

0 comments on commit 2fe97e0

Please sign in to comment.