Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable paste support in views.Application #556

Merged
merged 1 commit into from Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions views/app.go
Expand Up @@ -27,13 +27,20 @@ type Application struct {
style tcell.Style
err error
wg sync.WaitGroup
paste bool
}

// SetRootWidget sets the primary (root, main) Widget to be displayed.
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 {
Expand Down Expand Up @@ -127,6 +134,9 @@ func (app *Application) run() {
}()
screen.Init()
screen.EnableMouse()
if app.paste {
screen.EnablePaste()
}
screen.Clear()
widget.SetView(screen)

Expand Down