fixes #108 Space is Key() and not Rune() ?

This commit is contained in:
Garrett D'Amore 2016-05-18 20:10:04 -07:00
parent a04d3e916b
commit cf91b3e205
2 changed files with 2 additions and 6 deletions

View File

@ -949,7 +949,6 @@ func (s *cScreen) HasKey(k Key) bool {
KeyBackspace: true, KeyBackspace: true,
KeyTab: true, KeyTab: true,
KeyEscape: true, KeyEscape: true,
KeySpace: true,
KeyPause: true, KeyPause: true,
KeyPrint: true, KeyPrint: true,
KeyPgUp: true, KeyPgUp: true,

7
key.go
View File

@ -1,4 +1,4 @@
// Copyright 2015 The TCell Authors // Copyright 2016 The TCell Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License. // you may not use file except in compliance with the License.
@ -79,7 +79,6 @@ func (ev *EventKey) Modifiers() ModMask {
} }
var keyNames = map[Key]string{ var keyNames = map[Key]string{
KeySpace: "Space",
KeyEnter: "Enter", KeyEnter: "Enter",
KeyBackspace: "Backspace", KeyBackspace: "Backspace",
KeyTab: "Tab", KeyTab: "Tab",
@ -240,7 +239,7 @@ func (ev *EventKey) Name() string {
// has more precise information it should set that specifically. Callers // has more precise information it should set that specifically. Callers
// that aren't sure about modifier state (most) should just pass ModNone. // that aren't sure about modifier state (most) should just pass ModNone.
func NewEventKey(k Key, ch rune, mod ModMask) *EventKey { func NewEventKey(k Key, ch rune, mod ModMask) *EventKey {
if k == KeyRune && (ch <= ' ' || ch == 0x7f) { if k == KeyRune && (ch < ' ' || ch == 0x7f) {
// Turn specials into proper key codes. This is for // Turn specials into proper key codes. This is for
// control characters and the DEL. // control characters and the DEL.
k = Key(ch) k = Key(ch)
@ -446,7 +445,6 @@ const (
KeyGS KeyGS
KeyRS KeyRS
KeyUS KeyUS
KeySP
KeyDEL Key = 0x7F KeyDEL Key = 0x7F
) )
@ -457,6 +455,5 @@ const (
KeyEsc = KeyESC KeyEsc = KeyESC
KeyEscape = KeyESC KeyEscape = KeyESC
KeyEnter = KeyCR KeyEnter = KeyCR
KeySpace = KeySP
KeyBackspace2 = KeyDEL KeyBackspace2 = KeyDEL
) )