Apply GoDoc comment policy (comments for humans should have a space
after the //; machine-readable comments shouldn't)
Use strings.ReplaceAll instead of strings.Replace when appropriate
Remove if/else chains by replacing them with switches
Use short assignment/increment notation
Replace single case switches with if statements
Combine else and if when appropriate
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
On all terminals, ctrl-i sends a tab character (0x09). For some reason,
tcell.ModCtrl+tcell.KeyCtrlI is interpreted as ctrl-tab.
Similarly, ctrl-m sends a new line (0x0a) and
tcell.ModCtrl+tcell.KeyCtrlM is interpreted as ctrl-enter.
Remove control modifier for these two key definitions only. All others
do not work without them.
Fixes: 7a6c808c04 ("bindings: prepare for more modifers")
Fixes: https://todo.sr.ht/~rjarry/aerc/56
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
The left and right square brackets are inverted. Fix that.
Signed-off-by: Ivan Oleynikov <ivan.oleynikov95@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Allow to bind to < and > by using \< and \> in binds.conf. Ensure that
the single \ can still be properly used to bind to other commands.
For example, the following binds would work now:
\< = :prev-tab<Enter>
\> = :next-tab<Enter>
\ = :filter<space>
Fixes: https://todo.sr.ht/~rjarry/aerc/37
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Sebastian LaVine <mail@smlavine.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Parse the actual user bindings to determine what shortcuts are available
in the compose::review stage. Add a predefined list of commands for
which we want to display the keyboard shortcuts.
Fixes: https://todo.sr.ht/~rjarry/aerc/14
Signed-off-by: Robin Jarry <robin@jarry.cc>
For some unknown reason. tcell does not include the ctrl modifier for
the ctrl-h key event.
Fixes: 7a6c808c04 ("bindings: prepare for more modifers")
Fixes: https://todo.sr.ht/~rjarry/aerc/8
Signed-off-by: Robin Jarry <robin@jarry.cc>
When using aerc for multiple accounts often bindings might differ
slightly between accounts. For example:
* Account A archives to one directory (:archive)
* Account B archives to monthly directories (:archive month)
Add account specific bindings to allow the user to add a "context" to a
binding group using a context specifier and a regular expression.
Currently the only context specifier is 'account'.
The regular expression is validated against the accounts loaded from
accounts.conf and the configuration fails to load if there are no
matches.
Contextual bindings are merged with global bindings, with contextual
bindings taking precedence, when that context is active.
Bindings are be configured using a generic pattern of
'view:context=regexp'. E.g.:
# Globally Applicable Archiving
[messages]
A = :read<Enter>:archive<Enter>
# Monthly Archiving for 'Mailbox' Account
[messages:account=Mailbox$]
A = :read<Enter>:archive month<Enter>
In the above example all accounts matching the regular expression will
archive in the monthly format - all others will use the global binding.
Signed-off-by: Jonathan Bartlett <jonathan@jonnobrow.co.uk>
Also update to the tcell v2 PaletteColor api, which should keep the chosen
theme of the user intact.
Note, that if $TRUECOLOR is defined and a truecolor given, aerc will now stop
clipping the value to one of the theme colors.
Generally this is desired behaviour though.