On Thu, Aug 18, 2011 at 02:45:37PM +0200, Pascal Stumpf wrote:
> On Thu, Aug 18, 2011 at 06:46:12AM -0500, Marco Peereboom wrote:
> > It doesn't because this isn't what the man page states for keep
> > selection.  It only works with Scrn* functions and does not get tested
> > when DisownSelection is called, which is called from some other spots
> > directly as well instead of going through Scrn*.
>  
> No. It does what the manpage says: Keep the selection (= PRIMARY).
> Copying that to CLIPBOARD is a customisation that has nothing to do with
> keepSelection.

That isn't what the diff does.

> Anyway, more on the PRIMARY vs. CLIPBOARD problem:
> http://www.freedesktop.org/wiki/Specifications/ClipboardsWiki?action=show&redirect=Standards%2FClipboardsWiki

I am well aware of this document and the spec.

> So xterm cannot (by default) even copy stuff into CLIPBOARD by mere
> selection without violating the ICCCM. Imho, the correct way to solve
> this would be to implement explicit cut/copy/paste commands; and that
> way, it would truly handle both buffers like all other applications. In
> any case, something like this should probably go upstream.

Here is my script to test:
$ cat /home/marco/bin/showclip.sh
#!/bin/sh

for c in clipboard primary secondary
do 
        echo "==> $c"
        xclip -o -selection $c
        echo
done
echo "==> cut_buffer0"
xprop -root -len 1024 CUT_BUFFER0

The "Keep Selection" option _doesn't_ do anything at all.
Go through this use case to see it in action:
1 select something in xterm
2 run showclip.sh
        note how primary and cut_buffer0 have the same content
3 click on the same xterm ans watch the highlighting dissapear
4 run showclip.sh
        note how primary is cleared and cut_buffer0 still has the
        previous content

Now we can argue if that is intended or not but what I read in the man
page and ctlseqs.txt is that this option is a toggle for that.  Let me
quote ctlseqs.txt "Ps = 1 0 4 0  -> Keep selection even if not
highlighted.  (This enables the keepSelection resource).".

Additionally, cut buffers have been deprecated.  This means that all
modern applications that no longer look at them can no longer
effectively copy between xterm and said modern application (like gtk
apps).

Now lets go one further, if you set the selectToClipboard resource to
true, the same behavior occurs.  This violates clipboard behavior and
the principle of least astonishment.

Lastly, and this a slightly weaker argument however, here goes.  All the
other applications do NOT clear primary when text is unhighlighted.
xterm is the odd one out doing it's own thing.  I have not run across
any other app that exhibits this behavior.

The diff makes keepSelection work the way the man page and the
ctlseqs.txt document (at least the way I read it) AND the user gets to
pick which behavior he/she prefers.

Reply via email to