The Edit menu

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.

Undo

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.

Undo limit

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.

Redo

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.

Cut

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.)

Copy

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.

Paste

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.

Delete

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.)

Find and Replace...

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.
Click here to see the picture

Specifying the search and replace strings

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.

Command buttons

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

[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

[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

[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

[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.

Specifying search patterns as regular expressions

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.

Regular expressions and special search characters

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.

Summary

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.

Elements and character entities as search patterns

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.

Attributes

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.

Searching for text within an element

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.

Character entities

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.

Error messages

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.

Other search options

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.

Whole Words

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.

Case Sensitive

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.

Backwards Search

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.

Wrap

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.

Find Patterns

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.

Find In

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"

Find Next

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.

Check Spelling...

This menu item allows you to spell-check all or part of the text of your document.

Dictionaries

HoTMetaL PRO's spell-checking employs up to three different kinds of dictionaries.

All dictionaries are binary files and cannot be modified with a text editor.

Using the spell checker

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.


Click here to see the picture

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.

Correcting a misspelled word

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.

Leaving a word as-is

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.

When no more misspelled words are found, HoTMetaL PRO displays a note box informing you of this.

Restricting spell checking

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.

Edit Dictionary...

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.)

Thesaurus...

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 want to replace the current selection with a word from one of these lists, click on the word from the list and then click on the [Replace] button. Alternately, you can type a word directly into the text box labeled Replace with and then click on the [Replace] button. Any word that you select from one of the lists is immediately inserted in this text box.

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.