Contents of Article


Classic ISPF style CUT and PASTE

SPFLite clipboard mode

Windows-Style cut and paste

SPFLite Named Private Clipboards

Copy and Cut operations

Paste operations

Hybrid Copy primitive (CopyPaste)

Power Typing and the clipboard


Introduction


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.


Classic ISPF style CUT and PASTE


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.


CUT command

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.


PASTE command

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 logically 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 file is treated like there was an A line command on the Top of Data line.


 SPFLite clipboard mode


SPFLite supports a startup mode known as CLIP. This mode is specified by coding the characters '-CLIP' as a command-line operand when invoking SPFLite. In this mode, SPFLite will automatically load the contents of the Windows clipboard when started, and will save the current edit data back to the Windows clipboard on termination. See a discussion of the -CLIP command-line option under Starting SPFLite.   In addition, the Primary command CLIP may be entered at any time to open a new edit tab containing the contents of the current Clipboard. After you are finished, the contents are returned to the clipboard when the tab is closed.


Note:  It is important to understand that a CLIP Edit session copies the clipboard into an SPFLite controlled edit session dedicated to clipboard editing, and then copies it back to the actual clipboard when you're done. Remember:  The clipboard, and the clipboard edit session, are not the same thing.


While you are in the CLIP Edit session, you are not actually modifying the Windows clipboard - only a copy of what it was, prior to the CLIP Edit session beginning. What that means is that, while you are in a CLIP Edit session, you could jump outside of it, to another SPFLite edit tab, or outside of SPFLite itself, then copy more data to the Windows clipboard, and paste that into your CLIP Edit session (or into another CLIP Edit session), and you could continue doing that process as many times as you like. Only once you're done will the edit session be copied back to the Windows clipboard. This fact can make for some very interesting and powerful editing techniques.


Note: It is possible to have many CLIP edit sessions active at the same time. Each CLIP Edit session will be initialized with the current contents of the Windows clipboard at the time it is initiated. You might want to do this to create some "temporary editing sessions". This is a perfectly legal (if a bit unusual) thing to do, but if you decide to do this, remember that each time you close a CLIP Edit session, the contents of that session are copied back to the real Windows clipboard. Thus, if the final contents of the Windows clipboard when you are all done is important to you, you may have to carefully choose which CLIP Edit session you close last.


Windows-Style cut and paste


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 Named Private Clipboards


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".


Temporary Permanent Clipboards


No, that's not a typo, one problem with storing all Private Clipboards permanently is just that - they're permanent.  This is fine for a lot of clipboards containing boilerplate type data, you will be using them over and over.


But many times, you just need the clipboard data to stay around for a day or two.  Eventually, the \CLIP folder becomes cluttered with clipboard data that you have simply 'forgotten' about.   If you prefix your clipboard name with an underscore "_", then these clip files will be cleaned up automatically after two days. 


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.



Copy and Cut operations


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.


Paste operations


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.


Hybrid Copy primitive (CopyPaste)


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.


Power Typing and the clipboard


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: Elevate your documentation to new heights with HelpNDoc's built-in SEO