3.5 The Requester

In various situations, ne needs to ask you to choose one string from several (where “several” can mean a lot). For this kind of event, the requester is issued. The requester displays the strings in as many columns as possible and lets you move with the cursor from one string to another. The strings can fill many screens, which are handled as consecutive pages. Most navigation keys work exactly as in normal editing. This is true even of custom key bindings. Thus, for instance, you can page up and down through the list with Control-P and Control-N (in the standard keyboard configuration).

A special feature is bound to printing characters: the requester progressively advances to entries that match the characters you type without regard to case. You can use Backspace to incrementally undo your matched characters. This progressive matching works in two modes which you can switch between on the fly with either the Insert or Delete key. In the default mode, the cursor indicating your current selection simply advances to the next matching entry (if there is one). In the other mode, all entries which don’t match the characters you’ve entered are removed from the list so you only see the matching entries. The Backspace key incrementally returns them to your list as your match becomes less specific. You can switch between the two modes as often as you wish while searching for your desired entry. This lets you quickly navigate large lists to get to the entries you really want.

One example of a requester is the list of commands appearing when you use the Help command. Another is the list of document words matching a prefix given to the AutoComplete command. A third example is the file requester that ne issues whenever a file operation is going to take place. In this case, pressing Return while on a directory name will enter that directory and refresh the requester with that directory’s entries. Note also that, should the requester take too long to appear, you can interrupt the directory scanning with Control-\. However, the listing will likely be incomplete.

Yet another example of a requester is the list of documents you currently have open. This requester is displayed when you use the Select... entry from the Documents menu, or invoke the SelectDoc command with the f4 key. Documents with unsaved changes will be bold (if your terminal supports bold) and marked with an asterisk.

These documents are generally listed in the order they were opened. However, in this requester you can reorder these documents by using the keys bound to the NextDoc and PrevDoc commands, usually f2 and f3. Any document reordering and selection will only take effect if you exit the requester with the Return key.

You can also save named documents and close unmodified documents without leaving the SelectDoc requester by using the key bound to the Save and CloseDoc commands respectively, usually Control-S and Control-Q. You can’t close the last document this way because it would cause ne to exit.

Regardless of the type of requester, you can confirm your selection with Return just as with the input line (see The Input Line), or you can escape the requester without making a selection with f1 or the Escape key (or whatever has been bound to the Escape command).

Moreover, if you are selecting a file name through the requester there is a third possibility: by escaping with the Tab key, the file or directory name that the cursor is currently on will be copied to the input line. This allows you to choose an existing name with Tab and modify the name on the input line before hitting Return.

Note that there are two items that always appear at the top of a file requester: ./ and ../. The first one represents the current directory and can be used to force a reread of the directory. The second one represents the parent directory and can be used to move up by one directory level.

The path to file names and directories selected through the requester will be relative to the current directory, i.e. the directory you were in when you invoked ne. The exception is when you’ve entered a path on the command line that starts with a /, then hit Tab to invoke the requester. In that case the path eventually returned by the requester will be an absolute path. (Note that you can change the current document’s name from relative to absolute or absolute to relative with the NameConvert command either on the command line or from the Extras menu.)

All requesters present their selections by default in “row major order,” which means the second string is on the same row as the first but to its right, at the top of the second column, and so on across each row before filling in the next row down. If you prefer your lists displayed in “column major order”—the first, second, and third strings are in the same column and each column is filled before starting on the next column to the right—then use the RequestOrder command to switch that preference. The setting can be stored in your default preferences the next time you save them. See Preferences Commands.