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

Conversation

chrBrd
Copy link
Contributor

@chrBrd chrBrd commented Sep 10, 2022

Fixes #552

Identical to c3ed795, but for pasting.

@gdamore
Copy link
Owner

gdamore commented Sep 11, 2022

I'm less certain I like this ... although I guess it means applications will need to prepared for events they don't recognize (paste start and end).

In dcell ( a new D implementation of this) I made paste a single event, and would definitely think it should be opt-in.

@chrBrd
Copy link
Contributor Author

chrBrd commented Sep 17, 2022

The implementation in this PR is the least 'invasive' way of enabling pasting for an Application, but I'd agree the functionality would ideally be opt-in (I'm inclined to think mouse support should be too, but that would break BC now).

An alternatve approach that would allow opt-in could be something like:

type Application struct {
	widget Widget
	...
	paste  bool
}

func (app *Application) EnablePaste(on bool) {
	app.paste = on
}

func (app *Application) run() {
	...
	if app.paste {
		screen.EnablePaste()
	}
	...
}

I'm happy to implement it if you're fine with the approach?

Pasting is not supported when using the `Application` view. This commit enables pasting support on an opt-in basis.

Fixes gdamore#552
@chrBrd
Copy link
Contributor Author

chrBrd commented Sep 21, 2022

PR updated - I've gone ahead and implemented the changes I proposed above, should hopefully result in less 'back-and-forth' if you're happy with the solution. :)

@gdamore gdamore merged commit 178ac43 into gdamore:master Oct 17, 2022
@gdamore
Copy link
Owner

gdamore commented Oct 17, 2022

Thanks for your contribution! If you want a listing in AUTHORS please submit a follow up PR.

@chrBrd chrBrd deleted the fix-#552 branch October 17, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow pasting when using views/app.go
2 participants