From 0e76ba142aa1b968c7d221ea31631d1094fc2e87 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Fri, 7 Oct 2022 14:48:42 +0200 Subject: [PATCH] fix(key): recover the insert key We started supporting insert in #418, but then accidentally removed it during a rebase in #396. Oops. --- key.go | 4 ++++ key_test.go | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/key.go b/key.go index 8a27702..444fc57 100644 --- a/key.go +++ b/key.go @@ -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 diff --git a/key_test.go b/key_test.go index c119cda..07c2743 100644 --- a/key_test.go +++ b/key_test.go @@ -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{