In Xorg, why do I lose the text selection in one window when I select in another window

clipboardxorg

This has been bugging me for a while now, and I just figured out what conditions cause it, but I don't know why, and if there is a (desired) workaround.

The cause is quite obvious when there are two windows side by side… Select text in one window, and the other window's selection becomes unselected… I always work at full-screen (17" monitor), so I was a bit slow on the uptake.

I assume that this has something to do with the primary selection mode of X, but I don't understand, why each window can't at least keep its text highlighted even it it isn't actually in the primary buffer (or is the primary buffer actually the highlighted text itself?)…

Programs such as Firefox manage to maintain the current "selection" under similar conditions, so it is possible. Why does this behaviour of de-selection exist (at all) ?

I find the primary selection to be useful, but I do use the clipboard more often (probably, because of issues like this), I wonder: is there some way to disable the X's primary selection mode–if that is the only workaround.. It may be too drastic, but I'd like to try it, if it's the only way.

Best Answer

If you select text with simple drag, it goes into what I usually call the 'soft' buffer - you can paste it with a simple middle mouse click, but the moment you select anything else it's gone.

On the other hand, gnome and KDE and other WMs generally also let copy selected text into a 'hard' buffer where it stays until you explicitly copy something else into it.

Programs like Firefox don't so much maintain the Xorg selection as that they add a selection mode of their own that just happens to coincide with it -- for example, if you select text in firefox, then select something in another window, then go back to FF and middle click to paste, you'll get the latter text.

Related Question