Cannot copy & paste from cell into xterm on Linux with X11
X11 Window System applications normally use two separate selections for copy & pasting text between windows: PRIMARY is whatever text has most recently been selected with the mouse, and CLIPBOARD is what has most recently been copied with Ctrl-C (in applications that support the Ctrl-XCV keys for cut/copy/paste).
In a Pluto notebook in e.g. Ubuntu Linux 20.04 running the X11 Windows System and Firefox 106, this does not work as expected in cells:
Expected behaviour: Selecting some text with the mouse from a cell should place the text into the PRIMARY selection. Afterwards, clicking the middle-mouse button in an xterm should then paste the text selected in the cell into stdin of the terminal application.
Actual behaviour: Selecting some text with the mouse from a cell does not place the selected text into the PRIMARY selection. Therefore, clicking the middle mouse-button in an xterm does not paste the text selected in the cell into the terminal application.
This problem only occurs when selecting text in cells. Selecting text from elsewhere on the notebook page correctly makes the selected text available to other applications in the PRIMARY selection. Selecting text in a cell followed by pressing Ctrl-C does correctly make the selected text available from the CLIPBOARD selection.
This is a problem for anyone who wants to copy selected text from a Pluto cell into a terminal application, such as xterm, because terminals cannot access the CLIPBOARD selection via the usual Ctrl-V key, because Ctrl-V is just one of the control codes that a terminal has to pass on to the terminal application. Terminal emulators usually can only paste the PRIMARY selection via middle mouse button (although some also support pasting the CLIPBOARD selection via Shift-Ctrl-V).
Simon Tatham's tool xcopy can be used to read both the PRIMARY selection (xcopy -r) and the CLIPBOARD selection (xcopy -r -b). At present, selecting text in a Pluto cell unexpectedly does not affect the output of xcopy -r.
Related: #1141 and #649
i think for me it would also be very useful if this would work, because I use the middle mouse button sometimes when codeing. The autocompletion is not always active in pluto so it is much more convinient to copy and paste variables by selecting them instead of having to press ctrl + C and ctrl + V all the time.