keys: properly support the alt modifier

This commit is contained in:
Raphael 'kena' Poss
2022-08-29 11:52:25 +02:00
committed by Christian Muehlhaeuser
parent f905b97756
commit 134a930f2d
2 changed files with 24 additions and 5 deletions

View File

@@ -134,6 +134,24 @@ func TestReadInput(t *testing.T) {
},
},
},
"alt+enter": {
[]byte{'\x1b', '\r'},
[]Msg{
KeyMsg{
Type: KeyEnter,
Alt: true,
},
},
},
"alt+ctrl+a": {
[]byte{'\x1b', byte(keySOH)},
[]Msg{
KeyMsg{
Type: KeyCtrlA,
Alt: true,
},
},
},
} {
t.Run(out, func(t *testing.T) {
msgs, err := readInputs(bytes.NewReader(td.in))