Chapter Contents

Previous

Next
SAS Companion for the OpenVMS Operating Environment

Customizing Cut-and-Paste Operations

The SAS interface to Motif uses the SAS concepts of marks and the paste buffer to provide the normal X Window System cut-and-paste behavior. The mark defines and highlights a region of text. The paste buffer retains a collection of text lines. In the SAS System, you must associate marks with a paste buffer by issuing a command such as STORE or CUT. This is different from other X applications, in which marks and paste are generally synonymous with each other.

You can do any of the following tasks with a marked area of text in many SAS windows:

Usually, a mark defines the text to be operated on by a STORE or CUT command that places the text into a named SAS paste buffer.

The default definitions enable you to cut and paste between the SAS interface to Motif and other X window clients or between the SAS interface to Motif and the XPRIMARY buffer in OpenVMS.

The following sections explain the parameters that are associated with cut-and-paste operations and their default definitions. You can use these parameters to customize cut-and-paste operations on your system.


Marking Text

The SAS System supports the character mark and the block mark. The behavior of the character mark resembles text marking in most X Window System terminal emulators. The range of the character mark spans whole interior lines between the starting point and the ending point of the marked text. Interior lines are those that are between the lines containing the starting point and the ending point. By contrast, a block mark is a rectangular region that includes one corner at the starting point and one corner at the ending point of the mark.

The SAS interface to Motif supports two methods of marking text. One method uses the MARK command. The other method uses the mouse to click and drag; the marks that are generated by this second method are called drag marks.


Using the MARK Command to Mark Text

The MARK command establishes a mode in the SAS window that lasts until you issue another MARK command.

Position the cursor by clicking at the beginning of the text that you want to mark. Issue the MARK command. Then, move the cursor to the end of the text that you want to mark and click. Issue the MARK command a second time. Before you issue the second MARK command, the end point changes as you move the window's text cursor by using the keyboard arrow keys, tabbing, clicking the mouse, or scrolling through the window's contents. Mark highlighting also changes as you change the cursor position.

You can issue the MARK command from the command line, or you can assign it to a function key. If you want to select a rectangular block of text instead of a string of text, add the BLOCK argument to the MARK command. With the MARK command, you can select more than one area of text in the same window at the same time. To unmark the selected text, issue the UNMARK command.


Using the Mouse to Mark Text

You can also use the mouse to select text by clicking and dragging the left mouse button (MB1) inside the SAS window. You can use keyboard modifiers to change the behavior of the marking. When you end a drag mark by releasing MB1, the SAS System performs an end-of-mark action that may generate a STORE command to save the contents of the mark into a SAS paste buffer. This feature is controlled by the SAS.markPasteBuffer resource. You can clear marks in a SAS window by clicking MB1 inside the SAS window or by starting a new drag mark in the SAS window.

The SAS interface to Motif supports the following mouse button behavior:

MB1 press and move
makes a SAS character mark starting at the point where the mouse button is depressed and marks an area with the mouse. The area that you mark is highlighted. Release MB1 to complete the mark.

Note:   Any existing marks in the same window are deleted when you press MB1.  [cautionend]

MB1 press and release
frees existing drag marks in the window except those that were created by the MARK command. You can use MB1 to position the text cursor inside a SAS mark.

MB2 press
generates a PASTE command at the location of the click, using the SAS.markPasteBuffer value as the name of the paste buffer if the resource is defined. If SAS.markPasteBuffer is not defined, press MB2 to generate a PASTE command with BUFFER=DEFAULT.

There are three modifier keys that may be used in conjunction with MB1 to produce the following results:

Unmodified
character mark and end-of-mark action

Shift
extend mark and end-of-mark action

CTRL
block mark and end-of-mark action

Mod1
alters end-of-mark action to the opposite of normal behavior.

The normal end-of-mark action depends on the setting of the SAS.markPasteBuffer resource. If this resource is defined, the normal action is to generate a STORE BUFFER=<name> command to store the newly created mark to the named paste buffer. If this resource is not defined, the normal action is to suppress the generation of the STORE command; the marked area remains highlighted.


Paste Buffers

SAS paste buffers are named objects that retain a copy of selected text. Each buffer is identified by a name of up to eight characters; the name is not case sensitive. Most commands operating on a SAS paste buffer support the BUFFER= option that enables you to identify the paste buffer. This paste buffer name directs the SAS interface to Motif to interact with the standard X inter-client data exchange mechanisms.

Paste buffers that are not associated with an X inter-client mechanism are called local paste buffers because their contents are known only within the scope of the SAS session. Paste buffers associated with X inter-client data exchange mechanisms are called extended paste buffers.

The SAS interface to Motif enables you to use X cut buffers and X selections to exchange information with other X clients. The paste buffer name determines whether the buffer has extended semantics in the context of the X data exchange mechanisms. The following list describes paste buffer names and their associations:

XPRIMARY
is the paste buffer associated with the X primary selection (PRIMARY).

XSCNDARY
is the paste buffer associated with the secondary selection (SECONDARY).

XCLIPBRD
is the paste buffer associated with the clipboard selection (CLIPBOARD). This paste buffer allows you to use the MIT X Consortium xclipboardclient with the SAS System.

XTERM
is the paste buffer associated with the exchange protocol used by the xterm client. XTERM is the default buffer. DEFAULT is an alias for XTERM. If you copy or cut text into the XTERM buffer, the text is actually copied or cut into all four of the past buffers. When you paste text from the XTERM buffer, the text is pasted from the XPRIMARY buffer.

XCUTn
is the paste buffer associated with the X cut buffer n, where the range of n is 0 to 7.

You can use an alias to associate the DEFAULT paste buffer to another SAS paste buffer name. In this way, operations that would otherwise occur in the context of the local DEFAULT paste buffer can use a paste buffer that is specific to X. This is most useful in the context of SAS menu operations that generate explicit STORE, CUT, and PASTE commands that make use of the DEFAULT paste buffer. Use the SAS.defaultPasteBuffer resource to define an alias for the DEFAULT paste buffer.

Resources can be defined to associate SAS paste buffers with the X11R5 version of xterm, a terminal emulator client based on X. To define an alias that associates the SAS DEFAULT paste buffer with the XTERM paste buffer, declare the following X resource for the SAS application:

SAS.defaultPasteBuffer: XTERM

Defining an alias that associates the DEFAULT paste buffer with the XTERM paste buffer enables you to copy and paste text between xterm windows and SAS windows. You can select the range of text in the xterm window with MB1 and use MB2 to paste the text into the SAS window. You can use MB1 to select a range of text in a SAS window and use MB2 to paste the text into an xterm window. When marked text in the SAS System is stored to a SAS paste buffer, the mark is released, and the text highlighting clears. This behavior is different from most X clients, in which the highlighting is retained as long as the client continues to own the associated X selection.

When one SAS session communicates with another SAS session, the text and the original text attributes, such as color, are preserved where possible when transfers are made via an X selection conversion. For example, if you have associated an XTERM alias with the SAS.markPasteBuffer and SAS.defaultPasteBuffer resources, and then you copy and paste text between two SAS sessions, the color and character attributes are preserved. However, if you copy and paste the same text into an xterm window while using the vi editor, you will not retain the SAS text color and attribute information. A subsequent paste of this selection into a SAS session window will contain text only with a default text color of WHITE and no additional attributes. Extended paste buffers that use X selection transfers include XPRIMARY, XSCNDARY, and XTERM. If you change the definition for SAS.defaultPasteBuffer and SAS.markPasteBuffer to XCUT0, you will not retain the text and color attributes when copying and pasting text between two SAS sessions.

If you use the XCLIPBRD extended paste buffer, you can use the MIT xclipboard client with the SAS System for retained-mode cut-and-paste conversions through the ICCCM CLIPBOARD selection protocol. Define one or both of these SAS resources as follows:

SAS.defaultPasteBuffer: XCLIPBRD
SAS.markPasteBuffer: XCLIPBRD

SAS commands that reference the DEFAULT paste buffer are associated with the X CLIPBOARD selection; mouse-based SAS marks will automatically be stored in the XCLIPBRD paste buffer.

If you want to use the CLIPBOARD selection only for some cut-and-paste interactions, you can issue the following KEYS window commands for selected windows:

STORE BUFFER=XCLIPBRD
PASTE BUFFER=XCLIPBRD

Note:   When you use the xclipboard client, SAS text attributes are not preserved in exchanges made between SAS sessions. However, when you use the SAS XCLIPBRD paste buffer without a clipboard manager such as the xclipboard client, SAS text attributes are preserved in exchanges between SAS sessions.  [cautionend]

Using Paste Buffers to Manipulate Text

If you want SAS to automatically copy selected text into your paste buffer every time you mark a region of text with the mouse, you should specify your paste buffer name in the SAS.markPasteBuffer resource. To generate a STORE command every time you mark a region of text with the mouse, define the following X resource for the SAS application:

SAS.markPasteBuffer: XTERM

Since the DEFAULT paste buffer is aliased to XTERM, you could also make the following declaration for SAS.markPasteBuffer to produce the same result:

SAS.markPasteBuffer: DEFAULT
The markPasteBuffer definition causes SAS to automatically issue a STORE command whenever you select text.

The STORE command, as well as the CUT and PASTE commands, support a BUFFER= option that specifies which buffer to use. When these commands are issued from function keys or menus whose definitions do not include the BUFFER= option, if the SAS.markPasteBuffer resource is not defined, these commands use BUFFER=DEFAULT. If this resource is defined, these commands use BUFFER=buffer-name.

You can customize your normal cut, copy, or paste keys to issue any of these commands with the BUFFER= option. For example, you can define a SAS SAS.keyboardTranslations binding for the sas-do-command() action that will be valid for the same set of operations in every SAS window and override the SAS SAS.keyboardTranslations definition for the osfCopy and osfPaste keys with the following specifications:

SAS.keyboardTranslations: #override
<Key>osfCopy: 
     sas-do-command("STORE BUFFER=XCLIPBRD") \n
<Key>osfPaste: 
     sas-do-command("PASTE BUFFER=XCLIPBRD")

For more information about customizing keys, see Customizing Key Definitions.

When you cut or copy and paste text between SAS session using the XTERM, XPRIMARY, or XSCNDARY paste buffers, the color and attribute information is preserved. However, if you copy and paste the same text into an xterm window while using the vi editor, the color and attribute information is lost. If you change the definition for SAS.defaultPasteBuffer and SAS.markPasteBuffer to XCUT0, then you will not retain the text and attributes when you copy and paste text between two SAS sessions.

Note:   When you use the xclipboard client, SAS text attributes are not preserved in exchanges made between SAS sessions. However, when you use the SAS XCLIPBRD paste buffer without a clipboard manager such as the xclipboard client, SAS text attributes are preserved in exchanges between SAS sessions.  [cautionend]

Using Paste Buffers for Information Exchange

You can use X Window paste buffers and X selections to exchange information with other X Window clients. The SAS System paste-buffer interface allows this interaction for all paste-buffer interaction commands and operations. With the SAS interface to Motif, you can use the following paste buffers:

For more information about these paste buffers, see Paste Buffers.

If you are not sure which X data exchange protocols your other X clients are using, you should use the XTERM paste buffer. You can specify your default paste buffer with the SAS.defaultPasteBuffer resource:

SAS.defaultPasteBuffer: XTERM

If you know that the X clients in your workstation environment all use the X PRIMARY selections to exchange data, you should use the XPRIMARY paste buffer:

SAS.defaultPasteBuffer: XPRIMARY
This specification uses both SAS and X resources more efficiently and provides for the on-demand transfer of data between clients.

You can also use the SAS XCLIPBRD paste buffer to interact with Motif clients that use the Motif clipboard mechanism for text exchanges. This clipboard mechanism makes it unnecessary to have a dedicated client such as xclipboard. For example, you can use XCLIPBRD to exchange text directly with the Motif xmeditor application when you select the Cut, Copy, or Paste items from the xmeditor Edit menu.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.