|
@@ -5,6 +5,7 @@ import (
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
+ "unicode"
|
|
|
)
|
|
|
|
|
|
// This is the current list of Extended keys we support:
|
|
@@ -334,3 +335,25 @@ func (d *Door) Input(max int) string {
|
|
|
// this is never reached
|
|
|
return line
|
|
|
}
|
|
|
+
|
|
|
+func (d *Door) GetOneOf(possible string) int {
|
|
|
+ var c int
|
|
|
+
|
|
|
+ for {
|
|
|
+ c = d.WaitKey(Inactivity, 0)
|
|
|
+ if c < 0 {
|
|
|
+ return c
|
|
|
+ }
|
|
|
+ r := unicode.ToUpper(rune(c))
|
|
|
+ if strings.ContainsRune(possible, r) {
|
|
|
+ // return upper case rune
|
|
|
+ return int(r)
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ c = strings.IndexRune(possible, r)
|
|
|
+ if c != -1 {
|
|
|
+ return c
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+}
|