bindings: add alt modifier

Enables bindings like <A-left>.

Signed-off-by: John Gebbie <me@johngebbie.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
John Gebbie 2022-09-01 09:54:43 +01:00 committed by Robin Jarry
parent abf6ec7f02
commit 14ddc0de8d
3 changed files with 118 additions and 1 deletions

View file

@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased](https://git.sr.ht/~rjarry/aerc/log/master)
### Added
- Support for bindings with the Alt modifier.
### Fixed
- `outgoing-cred-cmd` will no longer be executed every time an email needs to

View file

@ -241,14 +241,19 @@ func init() {
keyNames["semicolon"] = KeyStroke{tcell.ModNone, tcell.KeyRune, ';'}
keyNames["enter"] = KeyStroke{tcell.ModNone, tcell.KeyEnter, 0}
keyNames["c-enter"] = KeyStroke{tcell.ModCtrl, tcell.KeyEnter, 0}
keyNames["a-enter"] = KeyStroke{tcell.ModAlt, tcell.KeyEnter, 0}
keyNames["up"] = KeyStroke{tcell.ModNone, tcell.KeyUp, 0}
keyNames["c-up"] = KeyStroke{tcell.ModCtrl, tcell.KeyUp, 0}
keyNames["a-up"] = KeyStroke{tcell.ModAlt, tcell.KeyUp, 0}
keyNames["down"] = KeyStroke{tcell.ModNone, tcell.KeyDown, 0}
keyNames["c-down"] = KeyStroke{tcell.ModCtrl, tcell.KeyDown, 0}
keyNames["a-down"] = KeyStroke{tcell.ModAlt, tcell.KeyDown, 0}
keyNames["right"] = KeyStroke{tcell.ModNone, tcell.KeyRight, 0}
keyNames["c-right"] = KeyStroke{tcell.ModCtrl, tcell.KeyRight, 0}
keyNames["a-right"] = KeyStroke{tcell.ModAlt, tcell.KeyRight, 0}
keyNames["left"] = KeyStroke{tcell.ModNone, tcell.KeyLeft, 0}
keyNames["c-left"] = KeyStroke{tcell.ModCtrl, tcell.KeyLeft, 0}
keyNames["a-left"] = KeyStroke{tcell.ModAlt, tcell.KeyLeft, 0}
keyNames["upleft"] = KeyStroke{tcell.ModNone, tcell.KeyUpLeft, 0}
keyNames["upright"] = KeyStroke{tcell.ModNone, tcell.KeyUpRight, 0}
keyNames["downleft"] = KeyStroke{tcell.ModNone, tcell.KeyDownLeft, 0}
@ -256,8 +261,10 @@ func init() {
keyNames["center"] = KeyStroke{tcell.ModNone, tcell.KeyCenter, 0}
keyNames["pgup"] = KeyStroke{tcell.ModNone, tcell.KeyPgUp, 0}
keyNames["c-pgup"] = KeyStroke{tcell.ModCtrl, tcell.KeyPgUp, 0}
keyNames["a-pgup"] = KeyStroke{tcell.ModAlt, tcell.KeyPgUp, 0}
keyNames["pgdn"] = KeyStroke{tcell.ModNone, tcell.KeyPgDn, 0}
keyNames["c-pgdn"] = KeyStroke{tcell.ModCtrl, tcell.KeyPgDn, 0}
keyNames["a-pgdn"] = KeyStroke{tcell.ModAlt, tcell.KeyPgDn, 0}
keyNames["home"] = KeyStroke{tcell.ModNone, tcell.KeyHome, 0}
keyNames["end"] = KeyStroke{tcell.ModNone, tcell.KeyEnd, 0}
keyNames["insert"] = KeyStroke{tcell.ModNone, tcell.KeyInsert, 0}
@ -365,6 +372,38 @@ func init() {
keyNames["c-["] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlLeftSq, 0}
keyNames["c-^"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlCarat, 0}
keyNames["c-_"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlUnderscore, 0}
keyNames["a-space"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, ' '}
keyNames["a-a"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'a'}
keyNames["a-b"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'b'}
keyNames["a-c"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'c'}
keyNames["a-d"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'd'}
keyNames["a-e"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'e'}
keyNames["a-f"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'f'}
keyNames["a-g"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'g'}
keyNames["a-h"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'h'}
keyNames["a-i"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'i'}
keyNames["a-j"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'j'}
keyNames["a-k"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'k'}
keyNames["a-l"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'l'}
keyNames["a-m"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'm'}
keyNames["a-n"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'n'}
keyNames["a-o"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'o'}
keyNames["a-p"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'p'}
keyNames["a-q"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'q'}
keyNames["a-r"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'r'}
keyNames["a-s"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 's'}
keyNames["a-t"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 't'}
keyNames["a-u"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'u'}
keyNames["a-v"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'v'}
keyNames["a-w"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'w'}
keyNames["a-x"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'x'}
keyNames["a-y"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'y'}
keyNames["a-z"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, 'z'}
keyNames["a-]"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, ']'}
keyNames["a-\\"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, '\\'}
keyNames["a-["] = KeyStroke{tcell.ModAlt, tcell.KeyRune, '['}
keyNames["a-^"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, '^'}
keyNames["a-_"] = KeyStroke{tcell.ModAlt, tcell.KeyRune, '_'}
keyNames["nul"] = KeyStroke{tcell.ModNone, tcell.KeyNUL, 0}
keyNames["soh"] = KeyStroke{tcell.ModNone, tcell.KeySOH, 0}
keyNames["stx"] = KeyStroke{tcell.ModNone, tcell.KeySTX, 0}

View file

@ -812,26 +812,38 @@ following special keys are supported:
:
| c-up
: Ctrl+Up
| a-up
: Alt+Up
| down
:
| c-down
: Ctrl+Down
| a-down
: Alt+Down
| right
:
| c-right
: Ctrl+Right
| a-right
: Alt+Right
| left
:
| c-left
: Ctrl+Left
| a-left
: Alt+Left
| pgup
:
| c-pgup
: Ctrl+PageUp
| a-pgup
: Alt+PageUp
| pgdn
:
| c-pgdn
: Ctrl+PageUp
: Ctrl+PageDn
| a-pgdn
: Alt+PageDn
| home
:
| end
@ -852,66 +864,128 @@ following special keys are supported:
:
| c-space
: Ctrl+Space
| a-space
: Alt+Space
| c-a
: Ctrl+a
| a-a
: Alt+a
| c-b
: Ctrl+b
| a-b
: Alt+b
| c-c
: Ctrl+c
| a-c
: Alt+c
| c-d
: Ctrl+d
| a-d
: Alt+d
| c-e
: Ctrl+e
| a-e
: Alt+e
| c-f
: Ctrl+f
| a-f
: Alt+f
| c-g
: Ctrl+g
| a-g
: Alt+g
| c-h
: Ctrl+h
| a-h
: Alt+h
| c-i
: Ctrl+i
| a-i
: Alt+i
| c-j
: Ctrl+j
| a-j
: Alt+j
| c-k
: Ctrl+k
| a-k
: Alt+k
| c-l
: Ctrl+l
| a-l
: Alt+l
| c-m
: Ctrl+m
| a-m
: Alt+m
| c-n
: Ctrl+n
| a-n
: Alt+n
| c-o
: Ctrl+o
| a-o
: Alt+o
| c-p
: Ctrl+p
| a-p
: Alt+p
| c-q
: Ctrl+q
| a-q
: Alt+q
| c-r
: Ctrl+r
| a-r
: Alt+r
| c-s
: Ctrl+s
| a-s
: Alt+s
| c-t
: Ctrl+t
| a-t
: Alt+t
| c-u
: Ctrl+u
| a-u
: Alt+u
| c-v
: Ctrl+v
| a-v
: Alt+v
| c-w
: Ctrl+w
| a-w
: Alt+w
| c-x
: Ctrl+x
| a-x
: Alt+x
| c-y
: Ctrl+y
| a-y
: Alt+y
| c-z
: Ctrl+z
| a-z
: Alt+z
| c-]
: Ctrl+]
| a-]
: Alt+]
| c-[
: Ctrl+[
| a-[
: Alt+[
| c-^
: Ctrl+^
| a-^
: Alt+^
| c-\_
: Ctrl+\_
| a-\_
: Alt+\_
# SEE ALSO