Introduction to Keyboard Primitives

Contents


Introduction

Clipboard Functions now support Named Private Clipboards

Marked Text Blocks

Repetition factors

Movement Repetition


Introduction


In a key mapping definition, any string enclosed in ( ) parentheses is treated as a keyboard primitive function.  Keyboard primitives are those functions other than line commands or primary commands.  In early versions of SPFLite, the only primitives available were simple functions like Enter, Tab, Delete, Insert, and Arrow keys.  All those functions still exist (though some are renamed), and new ones have been added.  The available keyboard primitive functions are listed below.  Only primitive names predefined by SPFLite may be specified; you cannot create or add your own.


       To assist in remembering these function names, a drop-down list is provided in the lower right corner of the KEYMAP dialog, shown as Valid keyboard Primitives.  If you open this list and select an item by clicking on it, the value will be placed in the clipboard.   You can then paste that value into the text box for your desired key.  This saves time and avoids typing errors.


Clipboard Functions now support Named Private Clipboards


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 private clipboard.  For example, suppose a 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.


Marked Text Blocks


Many of the primitive functions require a block of text to be highlighted (marked), either with the mouse or keyboard mark functions.  For example, functions like (Copy) and (UperCase) require a block of text to have been previously highlighted (marked) before the data is copied or changed to upper case.   Now, if functions like these are used when the cursor is in the data area, but no data is actively being highlighted, the single character at the cursor position is used as if that character were highlighted.  Applying functions to single characters is now easier, faster and more reliable.


For example, a (Copy) function (normally mapped to Ctrl-C) is requested with no area marked, then the single character located at the cursor location will be copied to the clipboard.


Repetition factors


You may specify a repetition factor for primitive functions.  The repetition factor is specified as a decimal number just after the opening left parenthesis of the function, and followed by a colon.


Note there is also a Movement repetition provision available for the cursor movement primitives which is actually more efficient for those functions, see Movement repetition.   It does not preclude using the method directly below, it will simply perform the operation faster.


For example, the function (Right) will move the cursor one character to the right.  If you wanted to move the cursor four positions to the right, you previously had to specify this as (Right)(Right)(Right)(Right).  


With a repetition factor, this can be simplified to (4:Right).


It is also possible to use repetition factors to repeat literal text.  For example, to generate twenty asterisk characters, instead of using


               [********************]


you can now achieve the same effect with


               (20:[*])


and it will run faster.  This feature will make it easy to define long strings that would be impractical to enter literally.


For example, to generate 80 asterisks, you could specify (80:[*]), which would be difficult to enter in the KEYMAP definition if you had to individually type all 80 asterisks manually; you might count them wrong, or the entire string might not even fit in the field.                                      


Other than text repetition, repetition factors can only be used within primitive functions in ( ) parentheses, not on un-enclosed primary commands or on the other types of enclosed keyboard items like { } or < >.


Note: A repetition factor should only be applied to functions where it makes sense to use.  For example, cursor movement makes sense if repeated, while repeating a (Home) command would be redundant, and repeating other commands like (Ansi) or (Edit) would produce undesirable behavior.


Movement Repetition


The cursor movement primitives (Left), (Right), (Up) and (Down) will support an option direct repeat operand.  It is specified in KEYMAP when specifying the key by following the primitive name with a / and a numeric operand.   e.g. (Right/5)


For example if the Right Arrow key were mapped to (Right) and Ctrl-Right Arrow mapped to (Right/5), you would have the ability to move right normally with the Arrow key, and to move quickly by using the Ctrl-Arrow key.


Due to the way primitives are handled internally, a key mapped to (Right/5) will perform much faster than (5:Right).  


The (Column/n) function will move the cursor directly to column n of the data area.  If n is omitted, (Column) will move the cursor directly to column 1.



Created with the Personal Edition of HelpNDoc: Easily create EPub books