diff options
Diffstat (limited to 'src/tui')
| -rw-r--r-- | src/tui/light.go | 18 | ||||
| -rw-r--r-- | src/tui/tcell.go | 12 | ||||
| -rw-r--r-- | src/tui/tui.go | 5 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/tui/light.go b/src/tui/light.go index 9b1489fa..7b474181 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -360,6 +360,11 @@ func (r *LightRenderer) escSequence(sz *int) Event { if r.buffer[1] >= 1 && r.buffer[1] <= 'z'-'a'+1 { return Event{int(CtrlAltA + r.buffer[1] - 1), 0, nil} } + alt := false + if len(r.buffer) > 2 && r.buffer[1] == ESC { + r.buffer = r.buffer[1:] + alt = true + } switch r.buffer[1] { case 32: return Event{AltSpace, 0, nil} @@ -380,12 +385,25 @@ func (r *LightRenderer) escSequence(sz *int) Event { *sz = 3 switch r.buffer[2] { case 68: + if alt { + return Event{AltLeft, 0, nil} + } return Event{Left, 0, nil} case 67: + if alt { + // Ugh.. + return Event{AltRight, 0, nil} + } return Event{Right, 0, nil} case 66: + if alt { + return Event{AltDown, 0, nil} + } return Event{Down, 0, nil} case 65: + if alt { + return Event{AltUp, 0, nil} + } return Event{Up, 0, nil} case 90: return Event{BTab, 0, nil} diff --git a/src/tui/tcell.go b/src/tui/tcell.go index 8e5524ae..5f2b87fe 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -295,12 +295,24 @@ func (r *FullscreenRenderer) GetChar() Event { return Event{BSpace, 0, nil} case tcell.KeyUp: + if alt { + return Event{AltUp, 0, nil} + } return Event{Up, 0, nil} case tcell.KeyDown: + if alt { + return Event{AltDown, 0, nil} + } return Event{Down, 0, nil} case tcell.KeyLeft: + if alt { + return Event{AltLeft, 0, nil} + } return Event{Left, 0, nil} case tcell.KeyRight: + if alt { + return Event{AltRight, 0, nil} + } return Event{Right, 0, nil} case tcell.KeyHome: diff --git a/src/tui/tui.go b/src/tui/tui.go index e2f5ea58..f1fac5e3 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -85,6 +85,11 @@ const ( AltSlash AltBS + AltUp + AltDown + AltLeft + AltRight + Alt0 ) |
