diff --git a/client.go b/client.go index 695499e3..702bdc36 100644 --- a/client.go +++ b/client.go @@ -49,6 +49,7 @@ func run() { if gOpts.mouse { screen.EnableMouse() } + screen.EnablePaste() ui := newUI(screen) nav := newNav(ui.wins[0].h) diff --git a/ui.go b/ui.go index 343cb186..c562d1a1 100644 --- a/ui.go +++ b/ui.go @@ -664,6 +664,7 @@ type ui struct { styles styleMap icons iconMap currentFile string + pasteEvent bool } func newUI(screen tcell.Screen) *ui { @@ -1398,6 +1399,10 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr { switch tev := ev.(type) { case *tcell.EventKey: + if ui.pasteEvent { + return nil + } + // KeyRune is a regular character if tev.Key() == tcell.KeyRune { switch { @@ -1577,6 +1582,12 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr { } else { return &callExpr{"on-focus-lost", nil, 1} } + case *tcell.EventPaste: + if tev.Start() { + ui.pasteEvent = true + } else if tev.End() { + ui.pasteEvent = false + } } return nil }