Support the insert key

This can be used in e.g. textarea / textinput to enable "overwrite
mode".
This commit is contained in:
Raphael 'kena' Poss
2022-08-25 17:44:47 +02:00
committed by Christian Muehlhaeuser
parent cb4ff09b13
commit 2fe97e07d0

5
key.go
View File

@@ -199,6 +199,7 @@ const (
KeyPgUp
KeyPgDown
KeyDelete
KeyInsert
KeySpace
KeyCtrlUp
KeyCtrlDown
@@ -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",
@@ -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},
@@ -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