diff options
Diffstat (limited to 'src/tui/tcell.go')
-rw-r--r-- | src/tui/tcell.go | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/src/tui/tcell.go b/src/tui/tcell.go index 964c19e1..bda5d082 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -221,58 +221,65 @@ func (r *FullscreenRenderer) GetChar() Event { // process keyboard: case *tcell.EventKey: alt := (ev.Modifiers() & tcell.ModAlt) > 0 + keyfn := func(r rune) int { + if alt { + return CtrlAltA - 'a' + int(r) + } + return CtrlA - 'a' + int(r) + } switch ev.Key() { case tcell.KeyCtrlA: - return Event{CtrlA, 0, nil} + return Event{keyfn('a'), 0, nil} case tcell.KeyCtrlB: - return Event{CtrlB, 0, nil} + return Event{keyfn('b'), 0, nil} case tcell.KeyCtrlC: - return Event{CtrlC, 0, nil} + return Event{keyfn('c'), 0, nil} case tcell.KeyCtrlD: - return Event{CtrlD, 0, nil} + return Event{keyfn('d'), 0, nil} case tcell.KeyCtrlE: - return Event{CtrlE, 0, nil} + return Event{keyfn('e'), 0, nil} case tcell.KeyCtrlF: - return Event{CtrlF, 0, nil} + return Event{keyfn('f'), 0, nil} case tcell.KeyCtrlG: - return Event{CtrlG, 0, nil} + return Event{keyfn('g'), 0, nil} + case tcell.KeyCtrlH: + return Event{keyfn('h'), 0, nil} + case tcell.KeyCtrlI: + return Event{keyfn('i'), 0, nil} case tcell.KeyCtrlJ: - return Event{CtrlJ, 0, nil} + return Event{keyfn('j'), 0, nil} case tcell.KeyCtrlK: - return Event{CtrlK, 0, nil} + return Event{keyfn('k'), 0, nil} case tcell.KeyCtrlL: - return Event{CtrlL, 0, nil} + return Event{keyfn('l'), 0, nil} case tcell.KeyCtrlM: - if alt { - return Event{AltEnter, 0, nil} - } - return Event{CtrlM, 0, nil} + return Event{keyfn('m'), 0, nil} case tcell.KeyCtrlN: - return Event{CtrlN, 0, nil} + return Event{keyfn('n'), 0, nil} case tcell.KeyCtrlO: - return Event{CtrlO, 0, nil} + return Event{keyfn('o'), 0, nil} case tcell.KeyCtrlP: - return Event{CtrlP, 0, nil} + return Event{keyfn('p'), 0, nil} case tcell.KeyCtrlQ: - return Event{CtrlQ, 0, nil} + return Event{keyfn('q'), 0, nil} case tcell.KeyCtrlR: - return Event{CtrlR, 0, nil} + return Event{keyfn('r'), 0, nil} case tcell.KeyCtrlS: - return Event{CtrlS, 0, nil} + return Event{keyfn('s'), 0, nil} case tcell.KeyCtrlT: - return Event{CtrlT, 0, nil} + return Event{keyfn('t'), 0, nil} case tcell.KeyCtrlU: - return Event{CtrlU, 0, nil} + return Event{keyfn('u'), 0, nil} case tcell.KeyCtrlV: - return Event{CtrlV, 0, nil} + return Event{keyfn('v'), 0, nil} case tcell.KeyCtrlW: - return Event{CtrlW, 0, nil} + return Event{keyfn('w'), 0, nil} case tcell.KeyCtrlX: - return Event{CtrlX, 0, nil} + return Event{keyfn('x'), 0, nil} case tcell.KeyCtrlY: - return Event{CtrlY, 0, nil} + return Event{keyfn('y'), 0, nil} case tcell.KeyCtrlZ: - return Event{CtrlZ, 0, nil} + return Event{keyfn('z'), 0, nil} case tcell.KeyCtrlSpace: return Event{CtrlSpace, 0, nil} case tcell.KeyBackspace, tcell.KeyBackspace2: |