diff options
author | kt programs <ktprograms@gmail.com> | 2022-03-14 11:03:34 +0800 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-03-14 22:55:19 +0100 |
commit | 74366d895d5c5cce5c14424926bb5de229894884 (patch) | |
tree | a7f79c483abec9240d31fa1d54c7adfa506de254 /widgets/aerc.go | |
parent | 4bc43d2741fa4904e51fc5da71d15b804c556c43 (diff) | |
download | aerc-74366d895d5c5cce5c14424926bb5de229894884.tar.gz |
viewer: add key passthrough mode
When trying to search in less, keys bound to viewer functions can't be
used as part of the search query, which makes the search useless.
Add a view::passthrough binding mode and a :toggle-key-passthrough
command go toggle in and out of that mode. By default, typing '/' in the
viewer is bound to enabling key passthrough and automatically inserting
'/', to easily enter "less" search mode. When in the passthrough mode,
all bindings are ignored by default. The default binds.conf only defines
a single keybinding in that mode: <Esc> to get back out. $ex is bound to
<C-x> to allow typing colons.
Signed-off-by: Kt Programs <ktprograms@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r-- | widgets/aerc.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go index 8061f388..cfc42919 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -201,7 +201,12 @@ func (aerc *Aerc) getBindings() *config.KeyBindings { return aerc.conf.MergeContextualBinds(aerc.conf.Bindings.Compose, config.BIND_CONTEXT_ACCOUNT, selectedAccountName, "compose") } case *MessageViewer: - return aerc.conf.MergeContextualBinds(aerc.conf.Bindings.MessageView, config.BIND_CONTEXT_ACCOUNT, selectedAccountName, "view") + switch view.Bindings() { + case "view::passthrough": + return aerc.conf.MergeContextualBinds(aerc.conf.Bindings.MessageViewPassthrough, config.BIND_CONTEXT_ACCOUNT, selectedAccountName, "view::passthrough") + default: + return aerc.conf.MergeContextualBinds(aerc.conf.Bindings.MessageView, config.BIND_CONTEXT_ACCOUNT, selectedAccountName, "view") + } case *Terminal: return aerc.conf.Bindings.Terminal default: |