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>
This commit is contained in:
parent
518f3e962c
commit
cf319129de
3 changed files with 24 additions and 0 deletions
|
@ -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`.
|
- Hide local timezone with `send-as-utc = true` in `accounts.conf`.
|
||||||
- Persistent command history in `~/.cache/aerc/history`.
|
- Persistent command history in `~/.cache/aerc/history`.
|
||||||
- Cursor shape support in embedded terminals.
|
- Cursor shape support in embedded terminals.
|
||||||
|
- Bracketed paste support.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ func Initialize(content DrawableInteractive) (*UI, error) {
|
||||||
|
|
||||||
screen.Clear()
|
screen.Clear()
|
||||||
screen.HideCursor()
|
screen.HideCursor()
|
||||||
|
screen.EnablePaste()
|
||||||
|
|
||||||
width, height := screen.Size()
|
width, height := screen.Size()
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ type Aerc struct {
|
||||||
simulating int
|
simulating int
|
||||||
statusbar *ui.Stack
|
statusbar *ui.Stack
|
||||||
statusline *StatusLine
|
statusline *StatusLine
|
||||||
|
pasting bool
|
||||||
pendingKeys []config.KeyStroke
|
pendingKeys []config.KeyStroke
|
||||||
prompts *ui.Stack
|
prompts *ui.Stack
|
||||||
tabs *ui.Tabs
|
tabs *ui.Tabs
|
||||||
|
@ -290,6 +291,15 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
|
||||||
|
|
||||||
switch event := event.(type) {
|
switch event := event.(type) {
|
||||||
case *tcell.EventKey:
|
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.statusline.Expire()
|
||||||
aerc.pendingKeys = append(aerc.pendingKeys, config.KeyStroke{
|
aerc.pendingKeys = append(aerc.pendingKeys, config.KeyStroke{
|
||||||
Modifiers: event.Modifiers(),
|
Modifiers: event.Modifiers(),
|
||||||
|
@ -344,6 +354,18 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
|
||||||
x, y := event.Position()
|
x, y := event.Position()
|
||||||
aerc.grid.MouseEvent(x, y, event)
|
aerc.grid.MouseEvent(x, y, event)
|
||||||
return true
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue