# Word Completion

There is a clever word completion mechanism in HTML mode which saves you keystrokes and time while typing. It also helps you to make sure no tags are misspelt.

As explained elsewhere you can use either dialog windows or the status bar to insert new tags, but perhaps you prefer simply to type them. Then the word completion mechanism can help you. By default word completion is bound to ctrl-tab.

Tip: If you prefer another key binding to ctrl-tab for word completion you can change it using Config->Special Keys...

How word completion works is best explained with an example. Let us say you want to type a TABLE tag. First type

<ta

If you now hit ctrl-tab this is expanded to

    <TABLE|>
        •
    </TABLE>
    •

Alpha sees that you have typed "ta" and finds that TABLE is the only HTML element beginning by "TA" and therefore completes "TA" to "TABLE". Alpha also automatically inserts a closing tag.

Alpha now opens an attribute dialog where you can give values to the attributes of TABLE. This behavior is customizable. On page 2 in the general preference dialog you can tell Alpha not to open this dialog by unchecking Open attribute dialog after completing an emelent, if you prefer to type also the attributes. Clicking Cancel in the attribute dialog leaves the insertion point inside the opening tag, while clicking OK moves the insertion point to the template stop between the tags. Note that the attribute dialog is only opened if the element has any attributes, which you have put in the category Always ask about in the Use Attributes dialog. This is the same behavior as when you insert a template using a menu item for an element.

Let us see how you can use word completion to type the attributes. Assume you want the attribute CELLSPACING. Type the first few letters

    <TABLE ce|>
        •
    </TABLE>
    •

and hit ctrl-tab again. In this case there are two attributes beginning by "CE", CELLSPACING and CELLPADDING. If the preference, which is somewhat cryptically called List Pick If Mult Cmps is checked in the dialog Config -> Preferences -> Interface Preferences -> Completions then Alpha opens a window where you can choose which of the two attributes you want. Alpha then completes "ce" to

    <TABLE CELLSPACING="|"•>
        •
    </TABLE>
    •

You can now type the value you want for CELLSPACING hit tab and write the next attribute.

If List Pick If Mult Cmps is not checked Alpha will only complete "ce" to "CELL" as it does not know which attribute you want.

    <TABLE CELL|>•
        •
    </TABLE>
    •

### Word completion when typing attribute values

You can also use word completion to expand some attribute values. The types for which this is possible are:

- Predefined choices Alpha attempts to match against the list of predefined choices.
- URL Alpha attempts to match against your URL cache.
- Target window Alpha attempts to match against your window cache.
- Color Alpha attempts to match against the list of color names.
- Content type(s) Alpha attempts to match against the list of content types. If you type a list of content types Alpha will attempt to complete the one after the last comma.
- Media descriptors Alpha attempts to match against the list of media descriptors. If you type a list of media descriptors Alpha will attempt to complete the one after the last comma.
- Link types Alpha attempts to match against the list of link types. If you type a list of link types Alpha will attempt to complete the one after the last space.

Let us illustrate this with an example. Say you want the color "yellow" as the value of the COLOR attribute of a FONT element. Hitting ctrl-tab after you have typed

<FONT COLOR="ye|">

makes Alpha complete this to

<FONT COLOR="#FFFF00">

### Word completion when editing CSS and JavaScript

Word completion can also help you when you are editing CSS and JavaScript. See the CSS and JavaScript sections.

Previous page Next page