-
Notifications
You must be signed in to change notification settings - Fork 45
Fix confusion with paste buffers and keyboard shortcuts #135
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
Conversation
…buffer not clipboard
TODO find out what they are!
only if nobody has claimed the keyboard shortcut
select.go
Outdated
| func (t *Terminal) pasteText(clipboard fyne.Clipboard, secondary bool) { | ||
| var content string | ||
| if secondary { | ||
| content = t.SelectedText() | ||
| } else { | ||
| content = clipboard.Content() | ||
| } |
There was a problem hiding this comment.
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.
| 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() | |
| } |
There was a problem hiding this comment.
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.
Fixes #134