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) ## [Unreleased](https://git.sr.ht/~rjarry/aerc/log/master)
### Added
- Support for bindings with the Alt modifier.
### Fixed ### Fixed
- `outgoing-cred-cmd` will no longer be executed every time an email needs to - `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["semicolon"] = KeyStroke{tcell.ModNone, tcell.KeyRune, ';'}
keyNames["enter"] = KeyStroke{tcell.ModNone, tcell.KeyEnter, 0} keyNames["enter"] = KeyStroke{tcell.ModNone, tcell.KeyEnter, 0}
keyNames["c-enter"] = KeyStroke{tcell.ModCtrl, 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["up"] = KeyStroke{tcell.ModNone, tcell.KeyUp, 0}
keyNames["c-up"] = KeyStroke{tcell.ModCtrl, 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["down"] = KeyStroke{tcell.ModNone, tcell.KeyDown, 0}
keyNames["c-down"] = KeyStroke{tcell.ModCtrl, 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["right"] = KeyStroke{tcell.ModNone, tcell.KeyRight, 0}
keyNames["c-right"] = KeyStroke{tcell.ModCtrl, 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["left"] = KeyStroke{tcell.ModNone, tcell.KeyLeft, 0}
keyNames["c-left"] = KeyStroke{tcell.ModCtrl, 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["upleft"] = KeyStroke{tcell.ModNone, tcell.KeyUpLeft, 0}
keyNames["upright"] = KeyStroke{tcell.ModNone, tcell.KeyUpRight, 0} keyNames["upright"] = KeyStroke{tcell.ModNone, tcell.KeyUpRight, 0}
keyNames["downleft"] = KeyStroke{tcell.ModNone, tcell.KeyDownLeft, 0} keyNames["downleft"] = KeyStroke{tcell.ModNone, tcell.KeyDownLeft, 0}
@ -256,8 +261,10 @@ func init() {
keyNames["center"] = KeyStroke{tcell.ModNone, tcell.KeyCenter, 0} keyNames["center"] = KeyStroke{tcell.ModNone, tcell.KeyCenter, 0}
keyNames["pgup"] = KeyStroke{tcell.ModNone, tcell.KeyPgUp, 0} keyNames["pgup"] = KeyStroke{tcell.ModNone, tcell.KeyPgUp, 0}
keyNames["c-pgup"] = KeyStroke{tcell.ModCtrl, 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["pgdn"] = KeyStroke{tcell.ModNone, tcell.KeyPgDn, 0}
keyNames["c-pgdn"] = KeyStroke{tcell.ModCtrl, 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["home"] = KeyStroke{tcell.ModNone, tcell.KeyHome, 0}
keyNames["end"] = KeyStroke{tcell.ModNone, tcell.KeyEnd, 0} keyNames["end"] = KeyStroke{tcell.ModNone, tcell.KeyEnd, 0}
keyNames["insert"] = KeyStroke{tcell.ModNone, tcell.KeyInsert, 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.KeyCtrlLeftSq, 0}
keyNames["c-^"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlCarat, 0} keyNames["c-^"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlCarat, 0}
keyNames["c-_"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlUnderscore, 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["nul"] = KeyStroke{tcell.ModNone, tcell.KeyNUL, 0}
keyNames["soh"] = KeyStroke{tcell.ModNone, tcell.KeySOH, 0} keyNames["soh"] = KeyStroke{tcell.ModNone, tcell.KeySOH, 0}
keyNames["stx"] = KeyStroke{tcell.ModNone, tcell.KeySTX, 0} keyNames["stx"] = KeyStroke{tcell.ModNone, tcell.KeySTX, 0}

View file

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