Windows Clipboard, Cut and Paste
Contents of Article
SPFLite provides two basic methods to support Cut and Paste and the Windows clipboard.
Clipboard support is only for plain-text data. While Windows allows many types of data formats to be stored in the clipboard, only those formats which can be converted to plain text (that is, ANSI characters) can be used.
Technically, Windows categorizes these formats as TEXT, OEMTEXT and UNICODE. The standard ANSI (Windows 1252) character set, which SPFLite uses internally for all its data, is what TEXT is.
In practice, if you can paste characters into the Windows Notepad editor, and they display correctly, you can probably use them in SPFLite. If you try to paste text from a highly-formatted document in Microsoft Word, for example, you will lose all special formatting and some data may be lost or appear differently. And, if you tried to paste some highly specialized document, like a CAD drawing, you will probably get nothing.
The first supported method operates like the original ISPF CUT and PASTE commands. The operations work on whole lines only, not on partial line contents.
Selection of data for Cut operation is done via normal use of C/CC or M/MM line commands. Following selection of the data, a CUT command is entered on the command line. If C/CC was used to select the data, the lines are copied to the clipboard; if M/MM was used, the lines will be copied to the Clipboard and then deleted.
Note: The CUT primary command will do both cutting and copying actions. The command name CUT adheres to the IBM ISPF naming convention for this command, even if it is a bit "inaccurate" of a term. IBM decided on the command name CUT for ISPF a long time ago, before "cut" and "copy" had the more precise, commonly understood meanings they have today. If the line range is defined by a C/CC block, or by any type of line-control-range operand on the primary command line, a copy operation takes place. If the line range is defined by an M/MM block, a cut operation takes place.
Bear in mind that the COPY primary command is used for copying outside files into the current edit session, and has nothing to do with the clipboard. To copy from the clipboard, the PASTE command is required.
To paste lines from the Clipboard, enter an A, B, O/OO, OR/ORR or H/HH line command to indicate where the lines are to be inserted, and then enter PASTE on the command line. If A or B was used to indicate position, the Clipboard lines will be inserted at the indicated point. If O/OO was used the Clipboard lines will be overlaid on the indicated lines exactly like a Copy / Overlay operation using C/CC and O/OO line commands. If the H/HH line commands were entered, the lines marked with H/HH will be replaced by the pasted lines.
Note: if the file is empty at the time PASTE is entered, no A or B line command is needed. The Clipboard lines will simply be loaded into the file text area. Thus, a PASTE into an empty is treated like there was an A line command on the Top of Data line.
To support Windows style cut and paste, SPFLite has several primitive keyboard functions. By primitive, we mean functions like TAB, NewLine, Insert, Delete etc. These functions take effect immediately when used, and are neither a Primary or Line command, and must be mapped to a key in order to be used.
These functions can be seen when customizing the keyboard (see "Keyboard Customization and Keyboard Macros") and the functions may be assigned to whatever mappable keys you wish. The descriptions below are written in terms of the normal default assignment for these new keys.
SPFlite supports a feature called Named Private Clipboards.
Named Private Clipboards are areas where the current contents of the edit file may be saved and restored. A Named Private Clipboard may be directly created or pasted into an edit file without going through the standard Windows clipboard first.
A Named Private Clipboard is a permanent area, stored as a file having a file extension of CLIP and stored in the SPFLite directory under a folder called CLIP. SPFLite takes the "name" of the named clipboard and forms a file name of "name.CLIP".
Named Private Clipboards are available and shared with all active edit tabs, and are saved by SPFLite between sessions. So, whenever you start SPFLite, the named private clipboard contents from your last session are always available for use. You could, for example, use these to store frequently used 'boilerplate' text.
Use of Named Private Clipboards is entirely optional, and in no way affects the normal operation of the Windows clipboard functions in SPFLite.
A named clipboard is referred to by its name, which may be any user-selected name (which, as a "name", should avoid special characters and blanks). The name of a Named Private Clipboard should not be the same as any SPFLite keyword. In particular, you would run into problems if your Named Private Clipboard had any of the names BEFORE AFTER ERASE REPLACE REP REPL APPEND X or NX.
To cut text into a Named Private Clipboard, you simply include the name in the CUT primary command. To paste text from a Named Private Clipboard, you include the name in the PASTE primary command. See CUT and PASTE for more information.
You can edit a named clipboard just as easily as editing the Windows clipboard, by specifying CLIP name, where name corresponds to a named clipboard created by a CUT name command.
Keyboard functions that involve the clipboard can take an option to specify a Named Private Clipboard. The format of this option is a / slash followed by the name of the Named Private Clipboard. For example, suppose a Named Private Clipboard of myclip exists. To paste from the Windows clipboard, you would use the function (Paste), but to paste from the myclip private clipboard, you would use (Paste/myclip). This technique works for every keyboard function that uses a clipboard, such as (Copy), (CopyPaste), (Paste), (ClipPath), etc.
In order to perform a Copy or Cut, you need to select the desired text. Text may be selected by dragging over the text area with the left mouse button held down, or by use of the Arrow keys with the Shift key held down. The area being selected by these operations will be displayed in inverse video. (Note that using the Shift + Arrow keys is a default key mapping to the MARK functions. You can reassign these functions to any desired keys.)
To select a "2D" multi-line block of text with the mouse, you must hold down a Shift, Alt or Ctrl key first, unless you have enabled the Global Options checkbox that allows multi-line selects without the extra key. See Allow 2-D mouse selection without Shift/Ctrl/Alt for more information.
Keyboard selection may proceed past screen boundaries if keyboard scrolling is activated (Options - Keyboard), but mouse selection is always restricted to a single visible screen. Mouse selection now supports a double-click to select a 'word' and highlight it.
The keyboard selection uses the keyboard functions (MarkLeft), (MarkRight), (MarkUp), (MarkDown) and (MarkEnd). These primitive functions are mapped to the Shift-Left, Shift-Right, Shift-Up, Shift-Down and Shift-End keys, which are commonly used in other text editor programs.
Note that using the Shift + Arrow keys is merely a default key mapping to the MARK functions at installation time. You can reassign these functions to any desired keys.
You may also highlight a large span of lines using the T/TT line command.
Once selected, the data can be Copied with the (Copy) function, Cut with the (Cut) function or Lifted with the (Lift) function. These primitive functions are mapped by default to the Ctrl-C and Ctrl-X keys, just as in Windows.
The (Paste) function will paste the contents of the Windows clipboard, whether a single line or multiple lines.
Pasting may be done into any text line or the primary command line field. It is not a full line paste like Classic ISPF paste; you may paste the text at any point in the existing data in the line. The paste command is also sensitive to the current INS/OVR mode. If you are in Insert mode, the paste text will be inserted and existing text shifted right. If you are in OVR (non-insert) mode, the paste data will simply overtype the existing characters in the line.
The mapping of the primitive paste function (Paste) defaults to the Ctrl-V key, just as in Windows.
There is a hybrid primitive function called (CopyPaste) which can be used to make a dual-purpose key. When the key is pressed, if there is text selected on the screen, it acts exactly like the (Copy) function. If there is no selected text, it acts like the (Paste) key. A typical use of this would be to assign (CopyPaste) to the right mouse button (see Options-Mouse for how to do this).
This provides a powerful editing action when doing cut/paste, and operates like the QuickEdit facility on the Windows command line.
When you are in Power Typing mode, you can use the Windows-style clipboard functions described above. In addition, you can use the functions that are specific to Power Typing. These are (PowerCopy), (PowerCut) and (PowerPaste). See the section on Working with Power Typing Mode for more information.
Created with the Personal Edition of HelpNDoc: Full-featured Kindle eBooks generator