[comp.windows.x] Openwidows Cut/Paste and xterms

curt@oce.orst.edu (Curt Vandetta) (12/07/90)

  Hello folks,

  I'm wondering if anyone has gotten cut and paste to work between
  command tools or shell tools and an xterm window under Openlook ver 2?
  I can use the left button to cut and the middle button to paste in
  an xterm, and the cut and paste function keys in command tools and
  shell tools.  But they appear to be using different buffers and I can't
  figure out how to make them use the same buffer, any clues?

  Thanks,
  Curt
--------------------------------------------------------------------------

  Curt Vandetta				College of Oceanography
  curt@oce.orst.edu			Oregon State University

cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) (12/08/90)

Curt Vandetta writes:

>  I'm wondering if anyone has gotten cut and paste to work between
>  command tools or shell tools and an xterm window under Openlook ver 2?
>  I can use the left button to cut and the middle button to paste in
>  an xterm, and the cut and paste function keys in command tools and
>  shell tools.  But they appear to be using different buffers and I can't
>  figure out how to make them use the same buffer, any clues?

By default xterm uses the primary selection.  The XView cut/copy/paste
functions use the clipboard selection.

Copying text from an XView text or terminal subwindow to an xterm (or
any other editable Athena widget) is easy.  Use the mouse and the SELECT
and ADJUST buttons to select the text you want (do not CUT it).  The text
should now be highlighted.  Move the pointer to the xterm and press
the middle button.  The highlighted text is now copied to the xterm.

Going the other way is not quite so simple since you can not tell XView
objects to copy the primary selection from a non-XView object (or if
you can I haven't found out how yet) so you have to copy your xterm
selection into the CLIPBOARD selection.  I believe that you can set up
an xterm escape sequence to do this.  If you don't have a black belt
in xterm customization you can use the xclipboard client as an intermediary.
Once you get your xterm selection into the clipboard you can use the
OPEN LOOK paste function on it.

			Chris Flatters

holtz@netcord.Eng.Sun.COM (Brian Holtz) (12/08/90)

Put this in your .Xdefaults:

! Here's the deal.  Emacs only uses CUT_BUFFER0, xterm uses PRIMARY by
! default, and OpenWindows uses CLIPBOARD.  My solution is to have
! xterm cave in to the OpenWindows world by preferring CLIPBOARD
! whenever it is deciding what to insert, except I nod to Emacs by
! having middle click first try to insert not CLIPBOARD but
! CUT_BUFFER0. That way, Emacs-style pasting is always done with a
! middle click, and OpenWindows-style pasting is always done with the
! Paste button (L8).  Also, I set up copy (via either L6, left-drag,
! or right-click) to ram the selected text into all 3 buffers.
! Lastly, I convert between Emacs and OpenWindows by running xcutsel
! -selection CLIPBOARD.
!
! select-end():		order of arguments is insignificant
! insert-selection():	order of arguments is significant
!
XTerm*VT100.Translations: #override \
	Shift <KeyPress> Select:	select-cursor-start()\
					select-cursor-end(CLIPBOARD, CUT_BUFFER0, PRIMARY)\n\
	~Ctrl ~Meta <Btn2Up>:	insert-selection(CUT_BUFFER0, CLIPBOARD, PRIMARY)\n\
	~Ctrl ~Meta <BtnUp>:	select-end(CLIPBOARD, CUT_BUFFER0, PRIMARY)\n\
	<Key>L8:		insert-selection(CLIPBOARD, CUT_BUFFER0, PRIMARY)\n\
	<Key>L6:		start-extend() select-end(CLIPBOARD, CUT_BUFFER0, PRIMARY)
--
Brian Holtz (holtz@netcord.Eng.Sun.COM)

fmayhar@hermes.ladc.bull.com (Frank Mayhar) (12/11/90)

In article <9012071709.AA23568@zia.aoc.nrao.edu>, cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) writes:
|> Curt Vandetta writes:
|> >  I'm wondering if anyone has gotten cut and paste to work between
|> >  command tools or shell tools and an xterm window under Openlook ver 2?
|> >  I can use the left button to cut and the middle button to paste in
|> >  an xterm, and the cut and paste function keys in command tools and
|> >  shell tools.  But they appear to be using different buffers and I can't
|> >  figure out how to make them use the same buffer, any clues?
|> By default xterm uses the primary selection.  The XView cut/copy/paste
|> functions use the clipboard selection.
|> [...]
|> Going the other way is not quite so simple since you can not tell XView
|> objects to copy the primary selection from a non-XView object (or if
|> you can I haven't found out how yet) so you have to copy your xterm
|> selection into the CLIPBOARD selection.

The easiest way to do this is to crank up xclipboard (comes with the
X11 distribution), click the primary selection into it, then go to the
XView application and paste the text in.  This forces an extra step, but
it works.  The only thing to watch out for is that you have to keep
track of which copy of the xclipboard buffer you've pasted it into.  If I
understand it correctly, it has to be the newest incarnation.
--
Frank Mayhar  fmayhar@hermes.ladc.bull.com (..!{uunet,hacgate}!ladcgw!fmayhar)
              Bull HN Information Systems Inc.  Los Angeles Development Center
              5250 W. Century Blvd., LA, CA  90045    Phone:  (213) 216-6241