The Edit menu contains commands to do the basic editing: cut, copy, paste, or delete a selection, undo your last action, and perform find and replace operations.
Commands in this menu make extensive use of the clipboard. The clipboard is an area that holds parts of a document that have been cut or copied. It may contain markup. The clipboard may be used to transfer information between documents as well as within a document. Note that if markup is involved, it must comply with the rules file for the document into which the material is to be pasted.
Allows the effect of the last operation to be undone.
Most commands can be undone. There are, however, some HoTMetaL PRO actions that cannot be undone:
If you imagine a sequence of undo-able commands as a list, successive Undo commands will proceed through the list, starting at the most recent. Therefore, if you execute two Undo commands in a row you will undo the most recent action, and then undo the second most recent action. Note that since Undo is not itself an undo-able command, one Undo cannot undo another. This function is reserved for Redo, which is the inverse of Undo. (See the section on Redo.)
If you undo a Copy or Cut command, the previous contents of the clipboard will be restored.
The number of previous commands that can be undone is not limitless but rather is controlled by an undo limit. Once this limit is reached, each successive command will cause the oldest undoable command to be committed, that is, it will no longer be possible to undo that command. For example, if the undo limit is set to 1 and you Cut a selection and then Paste what you just cut, you will be able to undo the paste but not the cut. If the undo limit were 2 or greater, both the cut and paste could be undone. The default value for the undo limit is 10, but this can be changed by setting the undo_limit configuration variable.
This command allows the most recent undone command to be redone.
Redo operates in a way similar to Undo: a sequence of Redo commands re-does the most recent redo-able commands (i.e., commands that have been undone) in reverse order. Redo and Undo are inverses of each other: the net effect of an Undo and its corresponding Redo is to cause no change to the document.
If an undoable action is performed after a series of one or more Undo commands then the Undo commands will no longer be redo-able.
To illustrate how Redo works, suppose you Cut a selection in a document, and then Paste that selection somewhere else. If you perform two Undo commands, first the Paste and then the Cut will be undone. If you then execute a Redo, the Cut will be redone. A second Redo will then redo the Paste.
Removes the current selection from the document and places it in the clipboard. Any previous contents of the clipboard will be erased. The selection can then be pasted.
This command is used when you want to remove a section of text that will probably be pasted in elsewhere, in the same or another document. (Compare this command with Delete.)
Copies the contents of the current selection into the clipboard and erases any previous contents. The document is left unchanged.
This command is used when you want to duplicate a portion of the document without erasing it. The copied selection can be inserted elsewhere using the Paste command.
Transfers the contents of the clipboard to the document. If the document contains an insertion point, the clipboard is pasted at that point; if it contains a selection, then the contents of the clipboard overwrite the selection.
The clipboard can contain markup. If the paste would result in an incorrectly marked-up document, you may be prompted to either cancel the paste operation or continue with rules checking turned off. Some paste operations cannot be performed even with rules checking turned off.
Deletes the current selection from the document but does not transfer the selection to the clipboard. The clipboard remains unchanged. A selection that has been deleted cannot subsequently be pasted. (Compare this with the Cut command.)
Allows text, elements, and patterns to be found and replaced.
You are presented with a dialog box,
like the one illustrated below, that allows you to enter various values
and parameters.
The Find text box allows you to specify a search string of text characters, elements, character entities, or patterns. If the document contains a selection when you invoke Find and Replace... the selected text will automatically become the search string. If the selected text is longer than 255 characters, it will be truncated. If the selection contains a markup icon (an element or character entity) it will be truncated at the last character before the icon. A selection that starts with a markup icon will become a null search string, and therefore an existing selection cannot be used to cause an element to be the search string.
The Replace text box allows you to specify a replace string consisting of text characters, patterns, an element, or a character entity, with which you want to replace the search string.
The Find In text box allows you to restrict your search to a particular element.
The Find, Replace, and Find In strings are described in more detail below.
There are five buttons (including [Cancel]) along the bottom of the Find & Replace dialog box, which allow you to carry out several search and replace operations.
[Find] causes HoTMetaL PRO to search through the document for the search string according to the various search parameters chosen. If you click on [Find] and the search is successful, HoTMetaL PRO selects the text, character entity, or element that was found and scrolls to the selection. If the search fails, HoTMetaL PRO will beep. Also, a Not found message will be displayed at the bottom of the Find & Replace dialog box.
Text searches will not match if parts of the search string are found within different elements. If you are searching for `Fred and Barney', but the word `and' is in a separate element (emphasized, for example), the search string will not be matched.
[Replace] replaces the current selection in the document with the replace string. This command is enabled only when part of the document is selected.
[Replace then Find] replaces the current selection in the document with the replace string, and then resumes the search procedure. This command will be enabled only when part of the document is selected.
You would use this option if you wanted to manually examine each occurrence of the search string before doing a replacement: if you decide to perform the replacement, click on [Replace then Find] again; otherwise, click on [Find] to go to the next occurrence of the search string.
[Replace All] replaces all occurrences of the search string with the replace string. This command automates the whole find and replace process, not giving you the opportunity to choose individual cases. It is possible that some of the occurrences of the search string that are found cannot be replaced, because this would cause an incorrectly marked-up document. If so, these occurrences are skipped over. After the operation has been completed, a message will be displayed in the Find & Replace dialog box showing how many occurrences of the search string were found, and how many were replaced. The insertion point will now be at the end of the last replacement. Invoking the Undo command after [Replace All] will cause all of the replacements that were actually made to be undone.
When the Find Patterns option is on (see below), the
characters you type in the Find text box are
interpreted as patterns by HoTMetaL PRO: that is, the search string can
contain certain special search characters that allow the search string
to match a class of strings, or markup constructs. If your search string
does not contain any special search characters, HoTMetaL PRO will search
for exactly the text you have typed. On the other hand, if the search
string does contain special search characters, it is interpreted as a
regular expression that defines a pattern of characters to be
matched. For example, the special search character `.' (period) is used
in the pattern m...y
to match a sequence of
five characters beginning with `m' and ending with `y', e.g., the words
`money', `marry', `murky', etc. A complete description of HoTMetaL PRO
regular expressions and special search characters appears below. A
table at the end of the section provides a summary.
The following
characters are special search characters in a search pattern:
\ . * ? + ^ $ [ ]
In addition, the characters
`&' and `<' are special when one or the other appears as the first
character of the pattern.
If you want to search for any of these
as ordinary characters when Find Patterns is turned on, it
must be preceded by a backslash. For example, \.
is used to match a period.
Regular expressions are sequences of ordinary characters and special characters, combined according to certain rules.
The following list summarizes how these special search characters are interpreted, and how regular expressions are formed.
An ordinary character represents itself.
A string beginning with a `<', immediately followed by an element name (and possibly attributes and content, as discussed below), is used to match an element .
A string beginning with `&', immediately followed by a name, matches a character entity (see Insert Character Entity... in the Markup menu).
A period or dot, `.', represents a single, arbitrary character
(including a blank). So fo.d
would match `food',
`ford', `fond', `fold', etc. Similarly, s.o.
matches `stop', `shot', `snow', etc.
A single character, or a string enclosed in parentheses,
followed by an asterisk, `*', matches zero or more occurrences of that
character or string. For example,
l*ama
would match `ama', `lama', `llama',
`lllama', etc.
b(an)*a
would match `ba', `bana', `banana', and
so on. It is possible to combine the `*' with `.' to match arbitrary
strings of characters. So
s.*ch
matches `search', `such', `stretch',
`stopwatch', as well as `sch' and `skip lunch'. The search pattern
represents strings that start with `s' followed by zero or more
occurrences of an arbitrary single character (it doesn't have to be the
same character over and over) followed by the characters `ch'. Since the
period can match a blank space, this pattern can match a multi-word
string.
A single character, or a string enclosed in parentheses,
followed by a question mark, `?', matches zero or one occurrences of
that character or string. For example, to search for instances of both
`color' and `colour', you would use:
colou?r
A single character, or a string enclosed in parentheses,
followed by a plus sign, `+', matches one or more occurrences of that
character or string. For example, the following expression matches
`ben', `been', `beeen', and so forth, but not `bn'.be+n
Regular expressions may be enclosed within parentheses for grouping.
Two regular expressions separated by a vertical bar, `|', match
any string that matches either of the regular expressions. For example,
if you wanted to search for either `love' or `money', you would use the
expression:
love|money
In a more complex example, you
could combine two regular expressions given above: s.*ch|fo.d
A caret, `^', at the very beginning of a search pattern means
that text will match the pattern only if it immediately follows markup
(a start- or end-tag, or a character entity). Such text must not be
separated from the markup by white space. Anywhere else, the caret is
not treated as a special search character (except in sub-strings, see
below). For example, if you wanted to search for the word `Note'
immediately following markup, you could use:^Note
A dollar sign, `$', at the very end of a search pattern means
that text will match the pattern only if it is immediately followed by
markup. Such text must not be separated from the markup by white space.
Anywhere else, the dollar sign is not treated as a special search
character. For example, if you wanted to search for the word `sub'
immediately preceding markup, you could use:sub$
A pair of square brackets, `[' and `]', around any string of
characters defines a sub-string that matches any one of
the characters between the brackets. For example, an[dy]
matches `and' and `any'.
By contrast, a string of characters preceded by a caret, `^',
within brackets, matches any character not in the string. For
example, th[^ei][a-z]*
matches any word that
begins with `th', which is not followed by an `e' or `i'. It would
match `that' and `thought' but not `therefore' or `this'.
A sub-string, within square brackets, of the form
[char1-char2]
matches any character in the
range of ASCII characters beginning at char1 and ending at char2.
For example, the sub-string [e-p]
matches any
lowercase letter between `e' and `p', inclusive. The substring
[A-Za-z]
matches any upper- or lower-case letter. Note that
if searching is not in case-sensitive mode (see below), no distinction
between lower case and upper case letters is made in character ranges.
In this case, for example, the character range
[a-z]
would match any upper- or lower-case
letter.
An expression of the form [^char1-char2]
matches any character
not in the range of ASCII characters beginning at char1
and ending at char2.
A range can occur inside a sub-string. For example, the
pattern:[ac-fh]
matches any of `a', `c' through
`f', and `h'.
If you wish to use any of the characters `^', `]', or `-' as a regular character within a sub-string rather than as a special search character, there are certain rules you must follow.
[joy^]
[a-]
[]ab]
[ab]]
None of the otherwise special search characters, including `\' and `[' has special meaning within a sub-string.
If you surround a sub-expression in the search string by
parentheses, `(' and `)', you can refer in the replace string to
whatever this sub-expression matches. In general, an expression in the
replace string of the form `\n', where
n is a number from 1 to 9, means "replace this expression with
whatever the nth expression in brackets in the search string has
matched". For example, if the search string is (.*)read
and the replace string is\1ox
then if the
search string matches `bread', the found text will be replaced by `box'.
This is because the sub-expression `(.*)' matched the letter `b'; the
expression `\1' in the replace string means "replace this expression
with whatever is matched by the
first expression in parentheses in the search string". Therefore
`b' is substituted for `\1' and the replace string becomes `box'.
Here
is a more complicated example: suppose the search string is(v.*e) (v.*a)
and the replace string is\2 \1
Now the search
string may match the words `vice versa'. The first sub-expression,
`(v.*e)', matches `vice' and the second sub-expression, `(v.*a)',
matches `versa'. In the replace string, HoTMetaL PRO replaces `\2' by
what the second sub-expression in the search string matched, and
replaces `\1' by what the first sub-expression matched. Therefore the
replace string becomes `versa vice'. The net effect of the operation is
to replace an occurrence of `vice versa' with `versa vice'.
It
is possible to nest sub-expressions. In this situation, the
sub-expressions are numbered according to the order of occurrence of
their left parentheses. For example, if the search string were
(a(bc)d)
and the replace string\2 \1
the effect would be to find `abcd' and replace it by `bc abcd'.
The
expression `\0' in a replace string refers to the entire string that was
matched by the search string. E.g., if the search string werefish
and the replace string weregone \0ing
then an
occurrence of `fish' would be replaced by `gone fishing'.
The following table summarizes the regular expressions and special characters available in HoTMetaL PRO's search facility. See also the following sections that deal with searching for elements, attributes, and character entities.
A search string that begins with an open angle bracket, `<', followed by a valid element name matches an element of that name. If the search succeeds, the insertion point is positioned to the left of the start tag. It does not matter here or in other search options whether tags are visible or not (see Show/Hide Tags in the View menu). The name in the search string can optionally be followed by a closing angle bracket (>).
For example,
<META
matches the element that has the name META.
Element names are not case sensitive in HoTMetaL PRO, so `<meta' and
`<META' would match the same elements.
In a replacement operation, if the search string and the replace string are both elements, one or more occurrences of the element in the search string will be changed to the type specified in the replace string. The contents of the element will be unchanged. The tag in the replace string cannot be followed by text; if it is, an error message will be displayed and the operation will not be performed.
If only the replace string is an element, the text that is found will be removed and replaced. Replacement will not occur unless the document contains a selection.
It is possible to restrict the
search to an element with specific attribute values. This is done in
the search string by following the element name with a space-separated
list consisting of attributes names followed by an equal sign, `=',
followed by a regular expression contained in double quotes (" "). The
regular expressions are the same as those used to match text and are
used here to match the attribute's value. For example, <meta name="Expires" id=".*[012]"
would only search for those
META elements that had a NAME attribute with value
`Expires' and an ID attribute ending in a 0, 1, or 2.
You may specify as many attributes as you wish, and in any order.
Attribute values of an element may be replaced by specifying the replacement values in the replace string. Specify replacement attributes in the same way as you would specify attributes in a search string.
The search string can contain both an
element name and, following it, some text (or a pattern) that must be
matched within the element. In this case the element must end with a
closing angle bracket. For example,
<P>The
would match the word `The' anywhere
within the element
P. This is similar to the kind of restrictive searching that can
be done using the Find In string but it can be used in
conjunction with that feature to further restrict the search. In the
last example, if the Find In string is set to:
<OL
the word `The' would be matched if it appeared in a
paragraph in a ordered list but not if it appeared in a paragraph in
another context.
The search and replace strings may be character entities. Therefore the replacement commands can be used to replace an occurrence of an element, character entity, or text with another element or entity, or text.
A search
string that begins with an ampersand, `&', followed by a valid character
name matches a reference to a character entity of that name. (The name
in the search string can optionally be followed by a closing semi-colon,
`;'.) For example, <
matches a character
entity called lt. If the replace string consists of a character
entity, a character icon will be inserted into the document.
If you have a badly-formed search or replace string, HoTMetaL PRO will inform you of this with an error message at the bottom of the Find & Replace dialog box. This message will consist of a description of the error and the character position in the string at which the error occurred. Errors that will be reported include: invalid element or character entity names; unmatched parentheses and brackets in regular expressions; `?', `*', or `+' not preceded by any character; invalid character ranges.
For example,
if you use the search pattern:<QUAGMIRE
you will get the error message: In Find string: Invalid element name at position 2
because the HTML files do not contain an element called QUAGMIRE.
This message also indicates that the error was detected at the second
character in the search string.
There are five options that can be set in searches. You may want to search forward or backward through the file, match only whole words, match upper- and lower-case exactly, employ wrapping, or perform pattern searching. These options can be used in combination and are turned on or off by clicking in the five check boxes in the Find & Replace dialog box. The defaults for these options can be set with the appropriate configuration variable. In this case, the boxes will be selected, or not, according to the configuration setting. Values set with configuration variables may be overridden during your editing session by clicking in the check boxes in the dialog box.
A search string may be part of a word or it may represent an entire word. Turning on Whole Words means that the search will match a sequence of one or more whole words only. For example, if HoTMetaL PRO were told to look for `red' with Whole Words turned on, it would not find that string in `Fred'.
With this option turned on, the pattern `a.*z' will match `a tough quiz' but not the first 12 characters (including the spaces) of a `tough buzzard'. The default for this option can be set with the find_whole_words configuration variable.
When case sensitivity is turned on, HoTMetaL PRO will look for the search string exactly as you've typed it--matching upper case to upper case and lower to lower. With case sensitivity off, the program will find any variation: a search string of `alice' would match `ALICE', `alice' and `AliCE'. This option applies to patterns as well as text. The default for this option can be set with the find_case_sensitive configuration variable.
HoTMetaL PRO normally starts its searches at the insertion point (or the end of the selection) and moves towards the bottom of the file. Backwards Search indicates that you want the search to move from the insertion point (or the start of the selection) back to the top of the file. If wrapping is not enabled (see below), HoTMetaL PRO does not wrap around the beginning or end of the file, so you should always make sure that you begin your search from the appropriate place in the file. The default for this option can be set with the find_backward configuration variable.
When Wrap is turned on, HoTMetaL PRO will wrap around the top or bottom of the file, depending on whether you are doing a forward or backward search. The default for this option can be set with the find_wrap configuration variable.
This option allows you to turn on or off HoTMetaL PRO's ability to find patterns. If Find Patterns is turned off, any special characters that you type in the find or replace strings will be treated as ordinary characters. The default for this option can be set with the find_patterns configuration variable.
One of HoTMetaL PRO's more powerful search features is its ability to restrict a search to the contents of particular type of element. This means, for example, that you could use Find and Replace... to check that a word is in uppercase letters whenever it appears in a paragraph, but in upper and lowercase when it's part of a title.
The
Find In text box is used to specify the element that
you want to restrict searching to. The format for this string is
identical to that for the search string when searching for an element,
except that the element name can't be followed by text. Attribute values
may also be specified in the
Find In string--you may use a Find In string
such as: <li label="Donkeys"
Performs a search for the search string specified in the previous Find & Replace dialog box. Once a search string has been specified, this command has the same effect as clicking the [[Find]] button in the Find & Replace dialog box.
This menu item allows you to spell-check all or part of the text of your document.
HoTMetaL PRO's spell-checking employs up to three different kinds of dictionaries.
When you select Check Spelling..., HoTMetaL PRO starts spell-checking your document, using the system dictionary, supplementary dictionaries, and the user dictionary. The check starts at the insertion point and continues through the document, wrapping around to the top when the end of the document has been reached. If a word is found that has no entry in any of the dictionaries, a dialog box appears: the word is displayed at the bottom of the dialog box next to the label Misspelled Word and is also highlighted in the main window.
The scroll list contained in the dialog box will present a number of possible substitutions: this list includes words whose spelling or pronunciation is close to the unrecognized word. The words are listed in decreasing order of probability that they are the correct substitution.
If one of the words in the list is the correct substitute for the misspelled word, you may click on that word. The word you clicked on is then put in the text box labeled Replace with. You may also type the replacement word in the text box directly. This text box initially contains the unrecognized word. When the text box contains the desired substitution, click on the [Replace] button to make the change in the document.
If the unrecognized word is a word that you consider spelled correctly (perhaps it is a jargon word, a proprietary name, etc.) then you have several options.
If you expect this word to appear again in this document or in other documents, you may add it to the user dictionary by clicking on the [Add to Dictionary] button. If there is no current user dictionary you will be presented with a Load Dictionary dialog. Use this dialog as described in the section on the Edit Dictionary... menu item. After you load the dictionary, you will have to click on [Add to Dictionary] again to add the unrecognized word to the user dictionary.
Changes to the user dictionary will be saved automatically when you quit HoTMetaL PRO or save the current file.
When no more misspelled words are found, HoTMetaL PRO displays a note box informing you of this.
From within the Check Spelling dialog box it is possible to restrict spell checking to a selection in your document. This must be done in two steps. The first step is to define the restricted search area. Start by highlighting the portion of the document that you wish to restrict spell checking to. (This can be done from the structure view if you wish to select a large part of the document.) Then click on the [Set Restriction] button. This causes the restricted search area to be defined. Even if you later highlight some other part of the document, HoTMetaL PRO will still know where the restricted area is. This process does not actually enable restricted spell checking. To do this, you must then click in the check box labeled Restrict. If it is checked, restricted spell checking is enabled.
This command allows you to create and update a user dictionary or supplementary dictionary for use with the Check Spelling... command. It may also be used to load a user dictionary or switch dictionaries during an edit session.
If a user dictionary is already loaded when you invoke this command, HoTMetaL PRO brings up the Edit Dictionary dialog box. This dialog contains a list of words in the current user dictionary. To add a word to the dictionary, enter the word in the text box labeled Word and click on the [Add Word] button. To delete a word from the dictionary, click on that word in the list and then click on the [Delete Word] button.
If you select this command and no user dictionary is currently loaded, HoTMetaL PRO gives you the Load Dictionary dialog, which is a file selection dialog similar to the one invoked by the New... command. In this dialog box you can search for and load an existing user dictionary.
Note: The default directory is the one listed first with the `user_dict_path' configuration variable. The default file extension for a dictionary file to be loaded is specified with the `dictionary_ext' configuration variable.You can also create a new, empty, dictionary by typing a new dictionary name in the File Name text box. When the name of the dictionary you want to load or create is in the text box, click on the Load Dictionary button.
The Edit Dictionary dialog contains a [Load Dictionary] button, which will take you back to the Load Dictionary dialog, allowing you to load a new dictionary. (Remember that you can have only one user dictionary open at a time, so if you load a new dictionary, the one currently open will be saved in its current state and closed automatically.)
This command lets you consult an on-line thesaurus.
The document must contain a selected word when you invoke the command. The selection will be displayed at the top of the Thesaurus dialog box; if the selection is a word in the thesaurus, then the number of meanings for that word that the thesaurus contains will be indicated, and the first meaning displayed. The buttons [Next Meaning] and [Previous Meaning] can be used to display the different meanings. If the thesaurus does not contain the selected word, the dialog box will give a message indicating this.
The dialog box contains a menu that is used to display lists of words that are somehow related to the selected word (with the meaning you have chosen). The choices are:
If you wish to invoke the thesaurus with a new word from the document, highlight the desired word and click on the [Get Word] button.
It is not possible to edit the thesaurus.