Editing modes

Keystrokes can be used to edit names of objects, text, numbers or to invoke commands on highlighted expressions. In some cases, a keystroke could be interpreted in several ways. As a result, there are three editing modes in the Sym application. The current mode determines how keystrokes are handled. Sym uses three different highlight colors to indicate the current edit mode.

There are three different modes available for editing the content in a module. In Text mode, the editing works much like a typical word processing application. There is a caret that indicates the current location in the document and the arrow keys behave as you would expect when edit text. In this mode, if you highlight an expression, you can only highlight the whole expression, not move around the in the expression tree.

In Expression mode, the reverse is true. You can move around in the expression tree either using the arrow keys or mouse, but you can only highlight a whole paragraph of text.

You can switch between the editing modes using the Escape key or by double clicking. If you double click on text when the document module is in Expression mode, the document will switch to Text mode. If you double click on anything other than text when in Text mode, the document with swich to Expression mode.

When the module is in Expression mode, the status bar at the top of the module is blue and the highlighted content will have a blue background. In Text mode, the status bar is gray and the highlight background will also be gray.

In addition, when you are editing in Expression mode, you are also able to edit names and numbers. Any object that is a number and any object that is only a name can be switched to Name mode. In this mode, the highlight will be green and a caret will indicate the current position in the text of the name or number.

Table 1. Editing modes
Mode Description
Expression Expression mode is used to edit expressions in the document. An expression will be highlighted in blue when in Expression mode.
Name Name mode is used to edit the name of an object and to edit numeric values. An expression will be highlighted in green when in Name mode
Text Text mode is used to edit text. An expression will be highlighted in gray when in Text mode. In this mode, the arrow keys and mouse behave the way you would expect in a word processing application

In Expression mode, the arrow keys move the highlight in the expression tree. The right and left arrow keys move to the next or previous parameter in an expression. Up and down arrow keys move to the parent and child (respectively) of the current highlight. For example, in the expression y - | x |, if the | x | is highlighted, the up arrow will highlight the whole expression (the parent), the down arrow will highlight the x (first child), and left arrow will highlight the y (sibling).

Most other keystrokes are interpreted as commands in Expression mode. For example, the "s" key will invoke the Simplify command on the highlighted expression.

In Text mode, the right and left arrow keys move to the next or previous character in the current text. The up and down arrow keys move to the previous or next line in the same way that they do in a typical text editor.

Text objects are treated like any other object. In Expression mode the whole text object is highlighted. In text mode,

In Name mode, you are only able to edit the name of an object or edit the numeric value of a number. If you are editing a name, the autocomplete popup is used to help find the object you need.

If you create an empty box and start typing text, you will be editing the name of the object if the first character you type is not a number. If the first character is a number, you will create a Num object with the number you type as its value. If you create an empty box, switch to Text mode by either pressing Escape or the down arrow and start typing, you create a Text object.

In Expression mode, the down arrow key is also used to switch to Name mode when there are no child expressions in the current highlight and the current highlight is either a number or a name.

To insert text into a module, start with an empty box at the location of the text. Press Escape to switch to Text mode and start typing the text.

To insert an expression along with the text, press Enter at the end of a line of text, then press Delete follow by Escape to go back to Expression mode. Pressing Delete on an empty line of text will change the empty line of text to an empty box. The Escape key will switch you back to expression mode. Now you can edit the expression as usual.