From 2fe97e07d0b7db69070fe7679a0816618f56f61b Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Thu, 25 Aug 2022 17:44:47 +0200 Subject: [PATCH] Support the insert key This can be used in e.g. textarea / textinput to enable "overwrite mode". --- key.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/key.go b/key.go index 135571b..14dc10f 100644 --- a/key.go +++ b/key.go @@ -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