CodeMirror doesn't interact correctly with PRIMARY on Linux
Categories
(Core :: DOM: Selection, defect, P3)
Tracking
()
People
(Reporter: bzbarsky, Unassigned)
References
Details
STEPS TO REPRODUCE:
- Open console (e.g. by doing Ctrl+Shift+I)
- Type some stuff
- Select that stuff
- Middle-click in some other application
EXPECTED RESULTS: The selected stuff is pasted
ACTUAL RESULTS: Whatever was selected before step 3 is pasted.
It looks like selecting in the console doesn't place things in PRIMARY, unlike every single other editable area?
This makes it pretty hard to copy data out of the console into bug reports...
This used to be a bug report on scratchpad (bug 1466837), but if console is supposed to be the replacement ... it has the same issue.
Comment 1•6 years ago
|
||
Thanks for the bug report Boris.
The issue is probably in CodeMirror, which was used in Scratchpad, and is also used in Console (and debugger, style editor, …)
I'll try to address that and backport it in the CodeMirror lib.
Updated•6 years ago
|
| Reporter | ||
Comment 2•6 years ago
|
||
I don't think this is necessarily CodeMirror. For example, https://jsfiddle.net/Sk8erPeter/TcqAf/ works just fine with PRIMARY. The issue is more likely to do with whatever chrome document this stuff is running in and how it's set up.
Updated•6 years ago
|
Comment 4•5 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky] from comment #2)
I don't think this is necessarily CodeMirror. For example, https://jsfiddle.net/Sk8erPeter/TcqAf/ works just fine with PRIMARY. The issue is more likely to do with whatever chrome document this stuff is running in and how it's set up.
Didn't notice back then but the fiddle is broken (CodeMirror isn't loaded because of mixed content)
If you try with this demo https://jsfiddle.net/zndp9qk2/ , it doesn't work on Firefox, but does on Chrome.
It impacts all the apps using codeMirror like CodePen, jsbin, …
I'm not sure how text selection is handled in CodeMirror, but it doesn't change the document.getSelection() result.
Marijnh, are you doing anything specific to make the text selection available on primary?
Comment 5•5 years ago
|
||
CodeMirror (in desktop mode) focuses a hidden textarea, and creates a selection inside that. Since getSelection doesn't integrate with text selections inside input and textarea elements, you won't see your selection reflected there.
Programmatically setting a selection in a textarea doesn't change the X primary selection in Firefox, but it does in Chrome. I haven't found any way to work around that.
Comment 6•5 years ago
|
||
Thanks for the quick answer Marijn, let's see if the DOM team folks can shine a light on that.
Comment 7•5 years ago
|
||
The severity field is not set for this bug.
:hsinyi, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•5 years ago
|
Comment 9•4 years ago
|
||
Note that this also affects the Debugger UI (as reported in Bug 1699839)
Comment 10•4 years ago
|
||
I see both this issue and the reverse:
- Select text with mouse in some other application
- Middle-click to paste in console
I also see the same buggy behavior in code editor components used on web sites like CodeMirror, CodeJar, Ace, and Monaco. This affects web-based code editing environments like vscode.dev.
Plenty of us still use mouse selection and paste on Linux, despite the relatively low activity of this bug!
Description
•