diff options
author | Vitaly Ovchinnikov <v@postbox.nz> | 2023-09-29 18:48:47 +0000 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-10-22 14:56:27 +0200 |
commit | 14fc59f189775dbe95daf582c08c9c1b3cd949b2 (patch) | |
tree | 285a1b8bb0d4a27a0d04ebd09287d0cabd9654ce /app/msgviewer.go | |
parent | 6bbb477d441b17756f89e0034c26c4c3cdc941af (diff) | |
download | aerc-14fc59f189775dbe95daf582c08c9c1b3cd949b2.tar.gz |
terminal: add `:send-keys` command
Add a new command for sending keystrokes to the active terminal, if
there is one visible. Covers split preview, message viewer, composer and
the terminal mode.
This can be used to navigate the embedded applications to scroll or
safely quit them when needed.
Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app/msgviewer.go')
-rw-r--r-- | app/msgviewer.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/msgviewer.go b/app/msgviewer.go index bb63b28d..8ac22bcc 100644 --- a/app/msgviewer.go +++ b/app/msgviewer.go @@ -276,6 +276,24 @@ func (mv *MessageViewer) Invalidate() { ui.Invalidate() } +func (mv *MessageViewer) Terminal() *Terminal { + if mv.switcher == nil { + return nil + } + + nparts := len(mv.switcher.parts) + if nparts == 0 || mv.switcher.selected < 0 || mv.switcher.selected >= nparts { + return nil + } + + pv := mv.switcher.parts[mv.switcher.selected] + if pv == nil { + return nil + } + + return pv.term +} + func (mv *MessageViewer) Store() *lib.MessageStore { return mv.msg.Store() } |