4 ms·
"A mode where you could read or set the selection data with base64 quoted strings. This gives the application full control over its interaction with X's cut & p
by pmoriarty 8y ago
"A mode where you could read or set the selection data with base64 quoted strings. This gives the application full control over its interaction with X's cut & paste buffers. For example, if you Shift-select some text, the application can tell X about it so that other applications can paste. I think there is still an xterm configure option for this one."
base64-encoded selection data sounds intriguing, but I'm not sure I understand what base64 has to do with the application being able to tell X about some text being selected.
And doesn't X already know when some text has been selected, simply from the contents of the primary selection having changed?
- jhallenworld 8y agoSuppose you select text with the keyboard- in JOE you can do this by holding down Ctrl and repeatedly hit arrow keys (actually there are many ways to this- ^KB ^KK marking is another). In most editors for Windows you can do it by holding Shift and hit arrow keys. How is X supposed to know that you just made this selection? Normally it can not, because it's a tty/console application not in direct communication with the X server. The base64 selection feature allows a console application to do it: the program can send selection text to X any time it wants: it's some header, base64 text, and a trailer. When the terminal emulator receives this, it forwards it to the X server just as if you had done a mouse selection. The base64 is useful in the other direction (pasting into the terminal emulator running an editor). One minor advantage is that base64 is binary clean. Another is that the text is not just sent to the application- instead you get a sequence indicating that middle mouse button was pressed. The application then sends a request to the terminal emulator to have it send the paste data to the application. This is better because it allows you to paste by (for example) using an application specific keyboard sequence, not just a mouse action.
- pmoriarty 8y agoOh, I see. I was thinking of mouse selections, which (in Linux anyway) will instantly make whatever you selected with the mouse available to X. As to selecting text with the keyboard, Emacs at least does some magic to make copied text appear in the X primary selection. I personally find this more annoying than useful, as it clutters up my primary selection with random junk I've beeing editing in Emacs. So I personally prefer to only send the text to X when I deliberately call for it, by sending the text to the "xclip" utility as needed. It's possible to use the "xsel" utility as well. I'm not sure what is the advantage of putting the terminal in to the middle of this process. Why can't applications just send whatever text they want to X by using xclip or xsel? Pasting in to the terminal is another matter, of course, and I can understand the usefulness of being 8-bit clean and using base64.
- jhallenworld 8y agoYou might be ssh'd to another system, so xsel / xclip will not work.