| Summary: | [terminal] Middle mouse button copy/paste does not work with the terminal | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] Target Management | Reporter: | Anton Leherbauer <aleherb+eclipse> | ||||||||
| Component: | Terminal | Assignee: | Martin Oberhuber <mober.at+eclipse> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | eclipse | ||||||||
| Version: | 3.2 | ||||||||||
| Target Milestone: | 3.3 M5 | ||||||||||
| Hardware: | All | ||||||||||
| OS: | Unix All | ||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 300809, 335408 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Anton Leherbauer
Created attachment 187421 [details]
Suggested fix
This patch adds support for the clipboard type DND.SELECTION_CLIPBOARD which is used to handle the middle mouse button copy/paste feature.
Comment on attachment 187421 [details]
Suggested fix
CQ:WIND00250102
With the change, the "paste on middle mouse button" doesn't work for me on Windows any more.
I also have a couple other concerns especially wrt backporting this to 3.2.2:
a) In the backport, we need to live with the possibility that only tm.terminal
gets updated but tm.terminal.view might remain the old version. That way, it
can happen that a MouseAdapter is registered twice for the Terminal widget.
b) In the backport, some container might have expected to be able and register
its own MouseAdapter on the Terminal Widget for handling middle click
differently than doing a Paste (unlikely but possible).
Can we live with this situation? Or could you come up with a different patch for the backport, perhaps at the expense of supporting the "middle button paste" only after a right-click > copy operation?
Retaining the middle button "paste" support on Windows is a must-have I think since I believe that users got used to it already. Could we, perhaps, copy into BOTH the DND.CLIPBOARD and the DND.SELECTION_CLIPBOARD style buffers ?
I believe that the other version clash possibility (of tm.terminal.view getting updated but the tm.terminal widget not getting updated) can be prohibited by forcing a narrow lower bounds on the "require-bundle" version range of terminal.view.
Created attachment 187504 [details]
Backport fix
This is a backwards compatible fix which also restores the middle mouse button support on Windows.
The new patch looks mostly OK, I'm only concerned about introducing the Platform-specific code. We won't be able to test on all Platforms (eg Mac) so there is a small risk of introducing a regression. In TerminalViewConnection, could you try getContents(textTransfer, DND.CLIPBOARD | DND.SELECTION_CLIPBOARD) since bitwise OR'ing the constants is allowed as per the Clipboard#getContents Javadocs. If this does what we want on both Windows and Linux, we should be good on all Platforms. Created attachment 187511 [details] Backport fix (2) (In reply to comment #4) > getContents(textTransfer, DND.CLIPBOARD | DND.SELECTION_CLIPBOARD) This works on Windows, but under Linux/GTK the DND.CLIPBOARD is preferred over DND.SELECTION_CLIPBOARD, ie. the content from the last copy operation is used instead of the last selection event. Attached patch now uses Clipboard.getAvailableTypes(int) to determine whether the selection clipboard is available or not. This should work on all platforms. Patch applied - thanks! |