mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-07-15 15:43:50 +02:00

To avoid accidentally closing the pager while the passthrough mode is enabled (and therefore all key presses go to /dev/null), make sure to exit the passthrough mode when the pager exits. Also, to make the user experience more pleasant, exit the passthrough mode upon pressing the <enter> key in the pager virtual terminal. This should match the workflow where the users press "/" to start searching in the pager, and press enter to validate their search. Move the toggling of passthrough mode in a global function. Since that setting is global to all accounts, make sure to update all the status lines. Reuse that function for the :toggle-key-passthrough command and when exiting the message viewer or pressing enter. Reported-by: Jonathan Dowland <jon@dow.land> Signed-off-by: Robin Jarry <robin@jarry.cc>
30 lines
660 B
Go
30 lines
660 B
Go
package msgview
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/app"
|
|
"git.sr.ht/~rjarry/aerc/commands"
|
|
"git.sr.ht/~rjarry/aerc/config"
|
|
)
|
|
|
|
type ToggleKeyPassthrough struct{}
|
|
|
|
func init() {
|
|
commands.Register(ToggleKeyPassthrough{})
|
|
}
|
|
|
|
func (ToggleKeyPassthrough) Description() string {
|
|
return "Enter or exit the passthrough key bindings context."
|
|
}
|
|
|
|
func (ToggleKeyPassthrough) Context() commands.CommandContext {
|
|
return commands.MESSAGE_VIEWER
|
|
}
|
|
|
|
func (ToggleKeyPassthrough) Aliases() []string {
|
|
return []string{"toggle-key-passthrough"}
|
|
}
|
|
|
|
func (ToggleKeyPassthrough) Execute(args []string) error {
|
|
app.SetKeyPassthrough(!config.Viewer.KeyPassthrough)
|
|
return nil
|
|
}
|