Skip to content

Conversation

@andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Oct 31, 2025

Fixes #134

@andydotxyz andydotxyz marked this pull request as draft October 31, 2025 08:16
select.go Outdated
Comment on lines 73 to 79
func (t *Terminal) pasteText(clipboard fyne.Clipboard, secondary bool) {
var content string
if secondary {
content = t.SelectedText()
} else {
content = clipboard.Content()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't poked into all the code to check, but it seems unnecessary to pass the clipboard in here when you could access it directly via fyne.CurrentApp().Clipboard() instead and simplify the calling code.

Suggested change
func (t *Terminal) pasteText(clipboard fyne.Clipboard, secondary bool) {
var content string
if secondary {
content = t.SelectedText()
} else {
content = clipboard.Content()
}
func (t *Terminal) pasteText(secondary bool) {
// Not sure if it's possible for Clipboard to be nil.
// I assume fyne.CurrentApp() will never be nil.
if fyne.CurrentApp().Clipboard() == nil {
return
}
var content string
if secondary {
content = t.SelectedText()
} else {
content = fyne.CurrentApp().Clipboard().Content()
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, but I saw a cleaner solution - eliminating the bool and actually having two clipboards that model the two different ways of copy/paste.

The benefit of this is that selected text is remembered for later instead of only being available whilst currently selected.

@andydotxyz andydotxyz marked this pull request as ready for review November 11, 2025 12:28
@andydotxyz andydotxyz merged commit afcec15 into fyne-io:master Nov 21, 2025
5 checks passed
@andydotxyz andydotxyz deleted the fix/134 branch November 21, 2025 07:48
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.

"Shift + Insert" produces "^V" instead of correct keys in TermGrid key handling

2 participants