diff --git a/key/key.go b/key/key.go index 5533bfd..e33917f 100644 --- a/key/key.go +++ b/key/key.go @@ -65,16 +65,16 @@ func (km *Manager) Press(k Key) event.Event { keys := km.keys[i:] var count int64 if km.count { - numStr := "" + var countStr string for j, k := range keys { - if len(k) == 1 && ('1' <= k[0] && k[0] <= '9' || k[0] == '0' && j > 0) { - numStr += string(k) + if "1" <= k && k <= "9" || k == "0" && j > 0 { + countStr += string(k) } else { break } } - keys = keys[len(numStr):] - count, _ = strconv.ParseInt(numStr, 10, 64) + keys = keys[len(countStr):] + count, _ = strconv.ParseInt(countStr, 10, 64) } for _, ke := range km.events { switch ke.cmp(keys) {