diff options
Diffstat (limited to 'vendor/maunium.net/go/tview/application.go')
-rw-r--r-- | vendor/maunium.net/go/tview/application.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/maunium.net/go/tview/application.go b/vendor/maunium.net/go/tview/application.go index f3d6328..387c4c4 100644 --- a/vendor/maunium.net/go/tview/application.go +++ b/vendor/maunium.net/go/tview/application.go @@ -38,6 +38,8 @@ type Application struct { // be forwarded). mouseCapture func(event *tcell.EventMouse) *tcell.EventMouse + pasteCapture func(event *tcell.EventPaste) *tcell.EventPaste + // An optional callback function which is invoked just before the root // primitive is drawn. beforeDraw func(screen tcell.Screen) bool @@ -190,6 +192,24 @@ func (a *Application) Run() error { //a.Draw() } } + case *tcell.EventPaste: + a.RLock() + p := a.focus + a.RUnlock() + + if a.pasteCapture != nil { + event = a.pasteCapture(event) + if event == nil { + break + } + } + + if p != nil { + if handler := p.PasteHandler(); handler != nil { + handler(event) + a.Draw() + } + } case *tcell.EventResize: a.Lock() screen := a.screen |