Hex code

Stedi allows some rather extensive possibilities for entering special characters into the text directly via hex code or with the search and replace commands. To enter characters in the text by their hexadecimal (ASCII) code, one may use the Ctrl-H command. This command has two variations :

  1. If the Ctrl-H is followed by two hexadecimal digits, the corresponding code between 00 and FF is entered as a single character. It will be shown on the screen as the pixel image in the current font that belongs to that code. For example, a formfeed would be entered by Ctrl-H followed by 0c.

  2. If the Ctrl-H is followed by another control-character (or escape or backspace or return), the ASCII code of this character is entered in the text. It will be represented on the screen by the corresponding pixel image in the current font. An example is Ctrl-H followed by Ctrl-L for a formfeed.

The ctrl-H command is sometimes useful for making a file with control sequences by which a printer can be set in a selected mode. Note however that if the hexadecimal code 0a (linefeed) or 0d (return) is entered in the text, it will be read as a linefeed next time the file is read. It would be very difficult to edit such a file.

If the Ctrl-H is followed by a character that doesn't fulfil the above requirements, the Ctrl-H is canceled and the character is put in the text as if the Ctrl-H was never pressed. If there was already a single hexadecimal digit in the input buffer, it will be put in the text first. One can see whether the hex mode is active by the representation of the dirty bit in the status line. The little open circle will be replaced by the same little closed circle that is used for representing tabs if Ctrl-H has been pressed and the editor is waiting for a hexadecimal or control character.

This hex mode command can also be used in the command line and it can even be used to put special characters in file names. It cannot be used however to 'escape' a slash (/) in the search command. For this purpose, there is a second way to enter special characters that is only valid for the command line. In this case the character `escape' fulfils a role similar to the Ctrl-H, except for that any interpretations of the character that it `caught' are made during the execution of the command. After typing an escape in the command line, the next character is taken `at face value', even if it is a backspace. If two hexadecimal digits follow the escape, the whole of escape and the two digits is interpreted internally as a single character. The search routines will interprete escape followed by a slash (/) as the character slash (/) and will not interprete it as the delimiter of a search or replacement string. Instead of the escape character one may also use the backslash character. The difference is that this backslash character doesn't allow the user to type in special characters like a backspace immediately after it. This would have to be done again with the Ctrl-H command.

The main difference between these modes is the moment of translation. The Ctrl-H is translated immediately, the sequence with the escape key is interpreted later (during the search/replace) or not at all.

As in normal text editing, it is sometimes convenient to know what characters actually are present in a file if the ones that just appear blank on the screen. The Alt-T key allows you to tell what characters are actually there. The possible characters that are displayed on the screen as blanks are blanks themselves, tabs, and the null ASCII character. On IBM-PC-like computers also the character number 255 is represented by a blank space. In addition if there is no character at all to be displayed, the screen remains blank. After pressing the Alt-T, each of these 'white space' characters are given a unique representation. Blanks are displayed as small empty circles which are superscripted relative to other characters. Tabs are represented as small filled circles, also superscripted. Since a tab can represent several spaces depending on tab stops, the intermediate spaces in the range of a tab are not real characters and they remain blank. Finally the null ASCII character is given the representation of a small filled circle which is subscripted, so as to be able to distinguish it from a tab. When the 255-th character has to be presented this way it is shown as a colon. When no character is present at all, this place on the screen remains blank. The Alt-T commands serves as a toggle between the mode in which all characters are given unique representations and the mode in which all `white space' appears as blanks. On terminals the characters that are used for displaying the blanks, tabs and ASCII zeroes will be in the regular ASCII set. The blanks become a period, the tabs a greater than sign (>) and the ASCII zeroes become an underscore.

On most terminals it would not be very practical to try to present the non-ASCII characters. Even if the extended character set of the VT100 is used there aren't 256 different characters. For representing more than the standard character set the workstations and the micro computers clearly have an advantage. It is however possible to obtain the hex code of each character in a buffer by toggling the Alt-H key combination. Normally only characters are presented that have a legal screen representation. On terminals the non-ASCII characters aren't considered legal characters. Sending some of them over would mess up the terminal considerably. When the Alt-H combination is pressed once the screen changes drastically: At the position of each character there is now its first hexadecimal digit. After the Alt-H combination has been used again one gets the second hexadecimal digit. Hitting the Alt-H for the third time gives the original screen back. So the capital A would look like

    A   4   1
in the three representations, because the hexadecimal representation of the character A is 41.



Subsections