2

When a piece of text is highlighted with the mouse, it can be pasted by middle-clicking on the place you want, or by using the always classic Shift+Insert key combo. But, when the area where that selected text is closed, the paste option is not valid, since the copied text is deleted.

Where is exactly the ready-to-paste text stored? Why is dependent on the application where you grab the text from instead to store that piece of text anywhere else, e.g., in a place of the memory with no relation to the source of that highlighted text, and keep it there even when the application is closed or another text is selected?

1
  • Also, by selecting, you can paste with middle-clicking on most distros, however Shift+Insert won't work, for instance, on Debian 7 + gnome (it will paste from another clipboard). This is distro/GUI dependent apparently.
    – Kira
    Jan 11, 2016 at 22:49

2 Answers 2

3

In X, there will be one application which owns the current selection, which usually (but not always) is visible. When you paste into an X client, that application asks the X server for the selection data, and the request is referred to the selection owner, who provides the information.

The selection owner may be capable of providing the selection data in more than one format. For text, that may be UTF-8 (newer) or ISO-8859-1 (older).

Besides the selection, there are analogous transfers called cut buffers. Those can be transferred whether or not an application currently owns the selection — but have more limited datatypes.

The ICCM (Inter-Client Communication Conventions Manual) documents this. However, not all applications follow it (Netscape was a notable exception).

The clipboard is shared in a different way than X selections, and some people prefer that. The clipboard is less dependent on who actually owns the data at a given moment.

xterm implements X selection, clipboard and cut-buffers using the X Toolkit.

For reference:

0

I'm not sure but looks like you are talking about cut buffers.

For more info how clipboard and cut buffers works check out this links:

freedesktop clipboards short spec,
Inter-Client Communication Conventions Manual
X Selections, Cut Buffers, and Kill Rings.

Happy digging!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .