(ev *tcell.EventKey)
| 162 | } |
| 163 | |
| 164 | func readKey(ev *tcell.EventKey) string { |
| 165 | var s string |
| 166 | if ev.Key() == tcell.KeyRune { |
| 167 | switch ev.Str() { |
| 168 | case "<": |
| 169 | s = "<lt>" |
| 170 | case ">": |
| 171 | s = "<gt>" |
| 172 | case " ": |
| 173 | s = "<space>" |
| 174 | default: |
| 175 | s = ev.Str() |
| 176 | } |
| 177 | } else { |
| 178 | s = gKeyVal[ev.Key()] |
| 179 | } |
| 180 | |
| 181 | return addKeyModifier(s, ev.Modifiers()) |
| 182 | } |
| 183 | |
| 184 | func parseKeyModifier(s string) (tcell.ModMask, string) { |
| 185 | matches := reModKey.FindStringSubmatch(s) |