Fix a bug where control keys weren't being properly mapped

This commit is contained in:
Christian Rocha 2020-01-17 22:21:17 -05:00
parent 208f421470
commit 32dc19b3d3
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 2 additions and 2 deletions

4
key.go
View File

@ -46,7 +46,7 @@ const (
KeyLeft KeyLeft
KeyUnitSeparator KeyUnitSeparator
KeyBackspace KeyBackspace
KeyRune KeyRune = -1
) )
// Friendly key names // Friendly key names
@ -111,7 +111,7 @@ func ReadKey(r io.Reader) (Key, error) {
// Is it a control character? // Is it a control character?
if n == 1 && c <= keyUS || c == keyDEL { if n == 1 && c <= keyUS || c == keyDEL {
if k, ok := controlKeys[n]; ok { if k, ok := controlKeys[int(c)]; ok {
return Key{Type: k}, nil return Key{Type: k}, nil
} }
} }