aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-09-14 21:36:42 +0200
committerRobin Jarry <robin@jarry.cc>2022-09-14 22:19:42 +0200
commitcf319129de36a2832674466e28bfa2dbb9bfc0cc (patch)
treece3ef2274135c6b62e5432eb2d541f6005fc02d0 /widgets/aerc.go
parent518f3e962ce39fb9712bb693857789ab22adfe9c (diff)
downloadaerc-cf319129de36a2832674466e28bfa2dbb9bfc0cc.tar.gz
term: add bracketed paste support
Allow forwarding paste events to embedded applications. When a bracketed paste is in progress, do not process any command bindings. Signed-off-by: Robin Jarry <robin@jarry.cc> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index cbc37795..e210916f 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -33,6 +33,7 @@ type Aerc struct {
simulating int
statusbar *ui.Stack
statusline *StatusLine
+ pasting bool
pendingKeys []config.KeyStroke
prompts *ui.Stack
tabs *ui.Tabs
@@ -290,6 +291,15 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
switch event := event.(type) {
case *tcell.EventKey:
+ // If we are in a bracketed paste, don't process the keys for
+ // bindings
+ if aerc.pasting {
+ interactive, ok := aerc.SelectedTabContent().(ui.Interactive)
+ if ok {
+ return interactive.Event(event)
+ }
+ return false
+ }
aerc.statusline.Expire()
aerc.pendingKeys = append(aerc.pendingKeys, config.KeyStroke{
Modifiers: event.Modifiers(),
@@ -344,6 +354,18 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
x, y := event.Position()
aerc.grid.MouseEvent(x, y, event)
return true
+ case *tcell.EventPaste:
+ if event.Start() {
+ aerc.pasting = true
+ }
+ if event.End() {
+ aerc.pasting = false
+ }
+ interactive, ok := aerc.SelectedTabContent().(ui.Interactive)
+ if ok {
+ return interactive.Event(event)
+ }
+ return false
}
return false
}