User Interface
Caveat: this section describes the codings in the "standard" KeyboardTioga TIP-tables. You may, by using variant TIP-tables, get different codings.
The operations KeyboardTioga codes can be put in three classes: selection, searching, and pre-existing Tioga things that should have codings in standard Tioga but don't.
Selection
There is only one operation here, and it is parameterized in two dimensions. It is:
| | branch
| | node
| from here to begin of | line
Select | from here to end of | jointed name
| enclosing | word
| | subword
| | character
"Here" means where the caret was before the operation was invoked. When the first argument is "from here to end of", the operation moves the caret to the end of the indicated range of characters. Similarly for "from here to begin of". Branch, node, word, character, and current selection are all as in Tioga. A "line" is a (possibly empty) sequence of characters between nodebreaks or newlines. A jointed name is a sequence of alphanumeric characters and periods. The "subword" concept is meant to deal with our naming convention for compound names --- it picks out the component names. The selection will always be a point or range of characters, as far as Tioga is concerned (as opposed to, say, words, nodes or branches).
Some of the combinations are interpreted with some creativity, in order that this operation be more intuitive and useful. Here are some of the more creative interpretations (see if you can get by without reading them):
When the caret is between words, the interpretation of "enclosing word" is somewhat open: does it mean the preceeding word or the following word? The actual interpretation depends on the rest of the selection (assuming it's more than a point selection): it means the following word if the selection includes the following one, and the preceeding word if the selection includes the preceeding one. Similarly for the other levels of selection.
For levels that cannot consist of empty sequences of characters (i.e., jointed word, word, subword, and character), the strict interpretation of "from here to end of", when invoked with the caret a few nodebreaks away from the first character, means to include those nodebreaks. The actual interpretation does not include them. Similarly for "from here to begin of".
For levels that can consist of empty sequences of characters (i.e., branch, node, and line), the strict interpretation of "from here to end of", when invoked with the caret at the end of such a level, means the empty range of characters at the end. The actual interpretation is "from the beginning of the next to the end of the next". Similarly for "from here to begin of".
Unfortunately, there are no very good holes (big enough) in the current Tioga command encoding. The author is not particularly happy with his current choice of encoding for KeyboardTioga commands --- better ideas are solicited. At the time of this writing, the encoding for selection commands is as follows.
The selection operation is invoked by a two-or-three key chord. It always includes the Keyboard key (previously known as Next, or middle spare; amazingly, this key is labelled "Keyboard" on Dandelions). It also always includes a key that indicates the second parameter (the "level" of selection). The optional third is a logical shift key that gives the first parameter. The encodings of the parameters are sometimes based on positional mnemonics; sometimes based on textual ones; and sometimes have no mnemonic value at all (life is hard). Here are the encoding of the parameters:
First
BackSpace: from here to begin of
No key: from here to end of
Space: for enclosing
Second
E: branch
D: node
C: line
V: jointed word
W: word
S: subword
X: character
Unfortunately, this encoding collides slightly with the standard Tioga command encoding. The collision is with the Tioga `Next' commands. Their standard encoding is striking Keyboard (known to Tioga as Next), possibly with control or shift keys held down. KeyboardTioga offers two solutions to this collision. First, it makes the Next commands available by striking N (again possibly with control or shift keys held down) while holding down Keyboard. The second solution is enabled by a user-profile entry (KeyboardTioga.EmptyNext: BOOL ← TRUE) and works like this: if Keyboard is depressed and then let up without invoking any operations in between, the up-transition of the Keyboard key will be decoded (according to the control and shift keys) into a Next command. Note that since Keyboard is also known as Next, this means the only difference is that the command is decoded and invoked on the up-transition instead of the down-transition. And for those of you who like to change your mind, a special no-op has been defined, just for the purpose of defeating the invocation of the Tioga Next commands: Keyboard-DEL.
Fortunately, the encoding is only a matter of TIPpery --- it's easy to experiment with other (hopefully better) encodings.
Searching
There is only one operation here, and we call it "leap", in honor of the leap function of the SwyftWare system from Information Appliance Inc. (founded by Jeff Raskin). For those of you unfamiliar with leap, it can be considered as just a particular incarnation of incremental search. The basic idea is, you hold down the Leap key and type some text. After every keystroke, the text you've typed so far is searched for.
The search can proceed forwards or backwards. In either case, the document is considered circular, so if there's a match somewhere in the document, it will be found. Hitting the BackSpace key (while Leap is held) down toggles the direction of the search. All searches start out going forwards.
Unsuccessful searches return the selection to where it was when the Leap key was depressed.
There's one primitive facility for editing the string you're searching for. Hitting the Delete key (while Leap is held down, of course) strips the last character off the search string.
The search can be either case sensitive or case insensitive. Hitting the Keyboard key (while Leap is held down, of course) toggles case sensitivity. All searches start out insensitive to case.
Hitting Escape (while Leap is held down) repeats the last search, subject to the current direction and case sensitivity modes.
The Leap key is also known as Swat, right-hand-control, or lower spare on the Dorado; it is labelled "STOP" on Dandelions. Note that it's a good thing we don't type Control-something to enter characters, because holding down the (left)Control and Leap keys at the same time is a Swat!
Note that this usurps the function of the right-hand control key --- you can no longer use it to invoke the standard Tioga "control keystrokes".
Fortunately, the encoding is only a matter of TIPpery --- it's easy to experiment with other (hopefully better) encodings.
Randoms
Here are all those things you've been wishing were on the keyboard, but aren't.
Keyboard-A: Make the caret appear at the beginning of the selection.
Keyboard-Z: Make the caret appear at the end of the selection.
Keyboard-Period: Make the selection be only a point selection.
Keyboard-M: Make the selection be only a point selection, and then SetMesaLooks.
Keyboard-I: Makes pending delete selections into non-pending delete ones, and vice versa.
Keyboard-J: Like the "Normalize" menu operation.
Keyboard-N: The old `Next' operation (and its shifted and controlled variants).
Keyboard-P: Like the "PrevPlace" menu operation.
Keyboard-G: The very useful combination "caret after", then "select enclosing jointed name", and finally "find any def".
Tioga Atoms
In order to do its work, KeyboardTioga implements some additional Tioga operations. Like all Tioga operations, they are identified by ATOMs, which can appear in TIP-tables and the "Operations" field of the Edit Tool.
Select-And-Operate
The selection operation introduced earlier is actually just a special case of a more general select-and-operate operation, whose generality was pared from the keystroke encoding in order to reduce the complexity of the chords that must be struck. Select-And-Operate is parameterized in three dimensions. Through different combinations of parameters, a lot of useful operations can be achieved (e.g., CaretOnly; delete/move forward/backward one character, word, subword, line; MakePendingDelete; MakeNotPendingDelete). The operation is
| branch |
| node | caretOnly
from here to begin of | line | select
from here to end of | jointed word | select pending delete
for enclosing | word | delete
| subword |
| character |
| current selection |
"Here" means where the caret was before the operation was invoked. When the first argument is "from here to end of", the operation moves the caret to the end of the indicated range of characters. Similarly for "from here to begin of". Branch, node, word, character, and current selection are all as in Tioga. A "line" is a (possibly empty) sequence of characters between nodebreaks or newlines. The "subword" concept is meant to deal with our naming convention for compound names --- it picks out the component names. The selection will always be a point or range of characters, as far as Tioga is concerned (as opposed to, say, words, nodes or branches).
Some of the combinations are interpreted with some creativity, in order that this operation be more intuitive and useful. Here are some of the more creative interpretations (see if you can get by without reading them):
When the second argument is "current selection", the affected range of characters is always the current selection (regardless of whether you think the first argument says otherwise).
When the caret is between words, the interpretation of "for enclosing word" is somewhat open: does it mean the preceeding word or the following word? The actual interpretation depends on the rest of the selection (assuming it's more than a point selection): it means the following word if the selection includes the following one, and the preceeding word if the selection includes the preceeding one. Similarly for the other levels of selection.
For levels that cannot consist of empty sequences of characters (i.e., word, subword, and character), the strict interpretation of "from here to end of", when invoked with the caret a few nodebreaks away from the first character, means to include those nodebreaks. The actual interpretation does not include them. Similarly for "from here to begin of".
For levels that can consist of empty sequences of characters (i.e., branch, node, and line), the strict interpretation of "from here to end of", when invoked with the caret at the end of such a level, means the empty range of characters at the end. The actual interpretation is "from the beginning of the next to the end of the next". Similarly for "from here to begin of".
The strict interpretation of "line delete" would not delete the trailing carriage return, if any. The actual interpretation deletes it.
This operation is invoked by a sequence of three Tioga ATOMs. The first two give the first two parameters, and the last gives the final parameter and activates the operation. The ATOMs used are:
KbdBegin from here to begin of
KbdEnd from here to end of
KbdAll for enclosing
KbdBranch branch
KbdNode node
KbdLine line
KbdCompound jointed word
KbdWord word
KbdSubWord subword
KbdChar character
KbdCurSel current selection
KbdToPoint caretOnly
KbdSelect select
KbdSelectPendingDelete select pending delete
KbdDelete delete
Searching
The ATOMs used are:
ScanNull a no-op
ScanStart begin a leap
ScanRepeat repeat last successful search
ScanShorten drop last character
ScanUpper we want uppercase letters
ScanLower we want lowercase letters
ScanReverse reverse direction of search
ScanForward set direction of search to forward
ScanBackward set direction of search to backward
ScanToggleCase toggle case sensitivity
ScanTo add a character (given by the PARAM, which should be a ROPE of length 1)
Randoms
Only one new operation needed to be implmented here: the one that inverts the "pending-deletedness" of the selection. It is associated with the ATOM $KbdInvertPendingDelete.
Installation
The simplest way to use KeyboardTioga is to set your TiogaTIP user profile entry as below, get the TIP tables noticed (see below), and issue the KeyboardTiogaAndScan command. Following is a description of what's going on.
In order to use all of KeyboardTioga, you have to have KeyboardTioga. and KeyboardScan running, as well as layer KeyboardTioga.tip and KeyboardScan.tip in front of the standard Tioga TIP tables. You can get only one part or the other in the obvious ways. KeyboardScan.tip&.c2c.o does the leap operation, and the KeyboardTioga.tip&.c2c.o does the rest.
To layer KeyboardTioga.TIP and KeyboardScan.TIP in front of the standard Tioga TIP tables, make your user profile entries for Tioga TIP-tables say (in Cedar10.1):
Tioga.TiogaTIP: /cedar/KeyboardTioga/KeyboardScan.tip /cedar/KeyboardTioga/KeyboardTioga.tip Default
Tioga.ReadonlyTiogaTIP: /cedar/KeyboardTioga/KeyboardScan.tip /cedar/KeyboardTioga/KeyboardTioga.tip Default
Tioga.TypescriptTIP: /cedar/KeyboardTioga/KeyboardScan.tip /cedar/KeyboardTioga/KeyboardTioga.tip Default
or, in PCedar,
Tioga.TiogaTIP: KeyboardScan.tip KeyboardTioga.tip Default
Tioga.ReadonlyTiogaTIP: KeyboardScan.tip KeyboardTioga.tip Default
Tioga.TypescriptTIP: KeyboardScan.tip KeyboardTioga.tip Default
Additionally, you must get Tioga to reload its cache of TIP tables. This is done whenever you do a full boot. Tioga also has a command to do it; the standard encoding of this command is Control-!. Another way to do it is to use the DoTiogaOps command-tool command:
% DoTiogaOps SaveSelectionA ReadProfile RestoreSelectionA
(The SaveSelectionA and RestoreSelectionA are there because the ReadProfile operation unselects the selection.)
KeyboardTiogaAndScan.cm invokes KeyboardTiogaAndScan.require with the right working directory; KeyboardTiogaAndScan.require runs KeyboardTioga.c2c.o and KeyboardScan.c2c.o and invokes DoTiogaOps ReadProfile. Similarly KeyboardScan.cm & KeyboardScan.require and KeyboardTioga.cm & KeyboardTioga.require are for using only one or the other part.
Other Goodies
ListTiogaOps
There is a Cedar Commander command `ListTiogaOps' that lists the currently registered Tioga ops (i.e., the ATOMs whose names you can use in the "Operations" field of the EditTool).
TiogaUnixFilter
There are two Tioga ops that invoke UNIX commands to effect a transformation on the current Tioga selection. The first, UnixFilter, is given a UNIX command as a PARAM. That command is run with the (plain text part of) the current selection as stdin, and what's written to stdout replaces the current selection. If the command returns a non-zero status, the replacement is not done. Output to stderr is noted in the System Script. For example, this op can be used like this:
PARAM "m3pp" UnixFilter
The second, `UnixFileFilter', is like the first, except that files are used. The current selection is written to a temporary file. The command explicitly manipulates two file names (they replace the patterns `$1' and `$2'). The contents of the second file after successful command completion replace the current selection. Text written to stdout or stderr is noted in the System Script. More precisely, the PARAM is a command pattern. Wherever the command pattern contains a `$1', the first file name is substituted when creating a particular command instance; the second file name is substituted for `$2'; a `$$' is replaced by a single `$'; and `$' followed by any other character is left unmolested. For example, this op can be used like this:
PARAM "m3pp <$1 >$2" UnixFileFilter