This class provides a text editor specialized for editing source code. It includes generic features that are useful in a variety of languages, and therefore serves as a base class for language-specific editors. The EditProgram class is derived from the Edit class, and therefore inherits all of its features.
The editor automatically indents a line in response to a Tab
character, and
provides a command for indenting a region (the selection). To enter a
literal Tab
,
enter the sequence C-tab
(Control-Tab
).
The editor also colors comments and the strings
FIXME
and NOTE
, and provides a
method for commenting out a region.
It supports only line-oriented
comments (where a comment line is preceded by a specified comment
string), although some derived classes generalize this to other comment
styles.
The Recolorize
command in the Format
menu will update the colors after you have edited a file,
and a Tab
character will recolorize (and indent) the current line.
The fill region
command in the Format
menu will fill the set of lines identified by the selection so that they
are roughly the same length. It puts the comment prefix on each line, and
colors the region with the comment color.
The comment prefix can be set with the
Set Fill Prefix
command
in the Format
menu.
It will invoke a dialog that allows you to set or change the prefix
used to mark comments.
The width of the fill region can be set with the
Right Fill Column
command
in the Format
menu.
It will invoke a dialog that allows you to set or change the maximum
length of each line (which defaults to 70 characters).
Finally, the editor matches parentheses, brackets, and curly braces. When you enter a close parenthesis, the editor determines whether the corresponding open parenthesis is visible, and if it is, highlights the text between the open parenthesis and the close parenthesis.