On Wed, Aug 17, 2011 at 04:11:55PM -0500, Marco Peereboom wrote:
> After the long debate yesterday about clipboards sucking major eggs and
> stuff I started looking into the problem. One of the problems is that
> xterm doesn't honor the "Keep Selection" flag. The code is a little
> tangly but if I read it correctly it looks like a simple test was
> missed. This brings xterm in line with all other applications
> (including gtk ones) where, by default, if a selection is cleared on the
> screen it ISN'T cleared from PRIMARY. People who desire the clearing of
> PRIMARY should use the "XTerm*keepSelection: false" setting as described
> in the manual.
>
> This is just step one. The rest of the issues seem to be hidden in gtk.
>
> Index: button.c
> ===================================================================
> RCS file: /cvs/xenocara/app/xterm/button.c,v
> retrieving revision 1.17
> diff -u -p -u -p -r1.17 button.c
> --- button.c 7 Mar 2011 20:41:27 -0000 1.17
> +++ button.c 17 Aug 2011 21:01:24 -0000
> @@ -3890,7 +3890,7 @@ DisownSelection(XtermWidget xw)
>
> for (i = 0; i < count; i++) {
> int cutbuffer = CutBuffer(atoms[i]);
> - if (cutbuffer < 0) {
> + if (!screen->keepSelection && cutbuffer < 0) {
> XtDisownSelection((Widget) xw, atoms[i],
> screen->selection_time);
> }
>
Actually this seems to be a much better patch.
Index: button.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/button.c,v
retrieving revision 1.17
diff -u -p -r1.17 button.c
--- button.c 7 Mar 2011 20:41:27 -0000 1.17
+++ button.c 18 Aug 2011 14:12:19 -0000
@@ -2308,7 +2308,7 @@ SelectSet(XtermWidget xw,
if (!isSameCELL(&(screen->startSel), &(screen->endSel))) {
SaltTextAway(xw, &(screen->startSel), &(screen->endSel), params,
num_params);
} else {
- DisownSelection(xw);
+ ScrnDisownSelection(xw);
}
}