next up previous contents index
Next: Moving the Cursor Up: The Text Editor Previous: The Text Editor

Tree Cursors, Tree Positions and Bracket Mode

A tree  cursor  is a path from the root of a text tree to a tree  position, namely a character, a def ref or the end of a subtree. When text is being edited the tree cursor is mapped to a location on the screen, and this is where the editor places the screen cursor. Unfortunately, more than one tree position can map to a screen position. Take the following definition of the relation: gif

        <x>>=<y>==((<x><<y>) -> void).
In the tree represented by 3>=1 there are six tree positions: the entire def, the character 3, the end of the subtree containing 3, the character 1, the end of the subtree containing 1 and the end of the entire tree. These six tree positions are mapped into four screen positions:
        3>=1
        ^^ ^^
The first is for both the entire def and the character 3, the second is for the end of the subtree containing 3, the third is for the character 1, and the fourth is for the end of the subtree containing 1 and also for the end of the entire tree. If the screen cursor were under the 3, pressing the KILL key would either delete the entire def or just the 3, depending on where the tree cursor actually was.

To eliminate this ambiguity the window may be put into bracket  mode; in this mode all def refs are surrounded by square brackets, and the screen position that corresponds to the entire def ref is the left square bracket:

        [3>=1]
        ^^^ ^^^
Notice that the right square bracket corresponds to the end of the subtree containing 1; this gets rid of the other ambiguous screen position.

For another example of an ambiguity removed by bracket mode, consider the two trees

        [23>=1]   and   2[3>=1].
The first is quite reasonable, but the second is probably a mistake, since it expands to 2((3<1) -> void). In unbracketed mode both trees would be displayed as 23>=1.

The BRACKET toggle, , switches the current window into or out of bracket mode. It cannot be used in mouse mode.



next up previous contents index
Next: Moving the Cursor Up: The Text Editor Previous: The Text Editor



Richard Eaton
Thu Sep 14 08:45:18 EDT 1995