On Thu, Aug 18, 2011 at 10:17:31AM +0200, Mark Kettenis wrote:
> > Date: Wed, 17 Aug 2011 16:11:55 -0500
> > From: Marco Peereboom <ma...@peereboom.us>
> > 
> > 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.
> 
> Makes no sense.  The keepSelection check is already done in
> ScrnDisownSelection().  The only place where DisownSelection() is
> called directly is SelectSet(), and that should only happen if you
> explicitly shrink your selection to "nothing".

It goes down another code path.  This through me for a loop but the
trace shows this.

> As far as I know, xterm keeps the selection just fine.  If I select
> some text in one xterm, then click at some random place in that same
> xterm such that the text is no longer highlighted, I can paste it just
> fine into another xterm using the middle mouse button.

But not in any application that doesn't use CUT_BUFFER0.  Which these
days is about everything minus xterm.  This diff brings xterm in line
with everything else and as far as I can see with the man page.

> 
> > 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);
> >     }

Reply via email to