diff --git a/views/app.go b/views/app.go index 21aca059..1a6e2c5e 100644 --- a/views/app.go +++ b/views/app.go @@ -27,6 +27,7 @@ type Application struct { style tcell.Style err error wg sync.WaitGroup + paste bool } // SetRootWidget sets the primary (root, main) Widget to be displayed. @@ -34,6 +35,12 @@ func (app *Application) SetRootWidget(widget Widget) { app.widget = widget } +// EnablePaste enables or disables pasting support in the application. +// It must be called before Start or Run or else it will have no effect. +func (app *Application) EnablePaste(on bool) { + app.paste = on +} + // initialize initializes the application. It will normally attempt to // allocate a default screen if one is not already established. func (app *Application) initialize() error { @@ -127,6 +134,9 @@ func (app *Application) run() { }() screen.Init() screen.EnableMouse() + if app.paste { + screen.EnablePaste() + } screen.Clear() widget.SetView(screen)