KeyboardTiogaDoc.tioga
Spreitzer, December 1, 1985 1:59:11 pm PST
KeyboardTioga
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
KeyboardTioga
Spreitzer
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: KeyboardTioga allows to user to do with the keyboard some Tioga selection operations normally done with the mouse. It also provides a richer set of selection grains.
Keywords: Tioga, Editor, Mouse, Keyboard, Button, Branch, Node, Line, Word, Subword, Logical Word, Character, Select, PendingDelete, Delete, Caret, Point
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
Introduction
KeyboardTioga enables one to do more with the keyboard than vanilla Tioga. Some of this is accomplished by simply providing keystroke codings for pre-existing Tioga operations, and some also involves implementing new Tioga operations. In the first section ("User Interface") we'll discuss only the association between keystrokes and operations. In the next section ("Tioga Atoms") we'll discuss the Tioga operations that Keyboard Tioga adds --- you'll be interested in that only if you will be hacking TIP-tables. The last section ("Installation") discusses installing KeyboardTioga.
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 | word
   |   enclosing   | 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. 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., 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 based sometimes on positional mnemonics and sometimes on textual ones. 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
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 changes this encoding to be striking N while holding down Keyboard and also possibly control or shift keys.
Fortunately, the encoding is only a matter of TIPpery --- it's easy to experiment with other (hopefully better) encodings.
Searching
There is also only one operation here, also parameterized in two dimensions: it is select next/previous X, for some character X. This operation changes the selection to be exactly one character, the first X after (or before) the carat.
The selection operation is invoked by a two-to-four key chord. While holding down the Scan key (previously known as Swat, right-hand-control, or lower spare; this key is labelled "STOP" on Dandelions), strike the key (possibly while also holding down a shift key) for character to search for --- this searches forward; also holding down the BackSapce key makes the search go backward. For examples: to search for the next space, hit Scan-Space; to search for the previous ampersand, hit Scan-BS-Shift-7; to search for the next tab, do not hit Scan-LeftCtrl-I --- holding down both the left and right control keys tells the swat-watcher you want to do a world-swap debug!
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-P: Makes pending delete selections into non-pending delete ones, and vice versa.
Keyboard-J: Like the "Normalize" menu operation.
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 | word | select pending delete
for enclosing | subword | delete
        | 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
KbdWord  word
KbdSubWord subword
KbdChar  character
KbdCurSel current selection
KbdToPoint caretOnly
KbdSelect select
KbdSelectPendingDelete select pending delete
KbdDelete delete
Searching
This operation is invoked by a sequence of three Tioga ATOMs. The first says whether to search forward or backward. The second and third give the character to search for. The third gives a character, and the second says whether to use the uppercase or lowercase version (only meaningful when the third is a letter). The ATOMs used are:
ScanForward
ScanBackward
ScanUpper
ScanLower
ScanTo000 search for character '\000 (octal, of course, goddamit)
ScanTo001 search for character '\001
...
ScanTo140 search for character '\140
ScanTo173 search for character '\173
...
ScanTo177 search for character '\177
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 bringover the public parts of KeyboardTioga.DF into ///Commands/, set your TiogaTIP user profile entry as below, and issue the KeyboardTioga command. Following is a description of what's going on.
In order to use all of KeyboardTioga, you have to have KeyboardTioga.BCD and KeyboardScan.BCD running, as well as layer KeyboardTioga.TIP and KeyboardScan.TIP in front of the standard Tioga TIP tables. They are both exported by KeyboardTioga.DF. You can get only one part or the other in the obvious ways. KeyboardScan.TIP&BCD does the searching operation, and the KeyboardTioga.TIP&BCD 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:
Tioga.TiogaTIP: ///Commands/KeyboardScan.TIP ///Commands/KeyboardTioga.TIP Default
Tioga.ReadonlyTiogaTIP: ///Commands/KeyboardScan.TIP ///Commands/KeyboardTioga.TIP Default
Tioga.TypescriptTIP: ///Commands/KeyboardScan.TIP ///Commands/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
KeyboardTioga.Load, also exported by KeyboardTioga.DF, runs KeyboardTioga.BCD and KeyboardScan.BCD and invokes DoTiogaOps ReadProfile.