mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Treat space key as a control character (instead of a " ")
This commit is contained in:
6
key.go
6
key.go
@@ -256,6 +256,12 @@ func ReadKey(r io.Reader) (Key, error) {
|
||||
return Key{Type: KeyType(char)}, nil
|
||||
}
|
||||
|
||||
// If it's a space treat it like a control character (otherwise it gets
|
||||
// treated as the character " "
|
||||
if string(char) == " " {
|
||||
return Key{Type: KeyType(keySP)}, nil
|
||||
}
|
||||
|
||||
// Is it a special sequence, like an arrow key?
|
||||
if k, ok := sequences[string(buf[:numBytes])]; ok {
|
||||
return Key{Type: k}, nil
|
||||
|
||||
Reference in New Issue
Block a user