diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/ui/ui.go | 1 | ||||
-rw-r--r-- | widgets/aerc.go | 22 |
3 files changed, 24 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d5395ada..2002c711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Hide local timezone with `send-as-utc = true` in `accounts.conf`. - Persistent command history in `~/.cache/aerc/history`. - Cursor shape support in embedded terminals. +- Bracketed paste support. ### Changed diff --git a/lib/ui/ui.go b/lib/ui/ui.go index a4128a5c..632d5f1d 100644 --- a/lib/ui/ui.go +++ b/lib/ui/ui.go @@ -28,6 +28,7 @@ func Initialize(content DrawableInteractive) (*UI, error) { screen.Clear() screen.HideCursor() + screen.EnablePaste() width, height := screen.Size() 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 } |