Hexadecimal Mode Considerations

If an input file contains the null character or Hexadecimal mode has been initiated with the Alt-H key, the display changes to show the input file as a sequence of 16 byte "lines". Two views of each line are shown: a set of four groups of eight hexadecimal integers each, and the character representation of the line. An example of hexadecimal mode representation of a file is shown in the following figure.


 54686520 71756963 6B206272 6F776E20    *    The quick brown
 666F7820 6A756D70 73206F76 65722074    *    fox jumps over t
 6865206C 617A7920 646F672E 0D0A0D0A    *    he lazy dog.CRLF
Hexadecimal Mode Screen Layout

In the above example, CRLF represents two carriage return/line feed pairs. Changes can be made to either representation of the line. When moving the cursor over the file, a shadow cursor is displayed which follows the real cursor on the opposite representation of the line. When the cursor is on the hex representation, the shadow cursor will show the equivalent position on the character portion. When the cursor is on the character representation of the line, the shadow cursor will show the position in the hex portion.

When replacing characters in Hexadecimal mode, the cursor position is important. When over one of the hex sections of the line, only the characters 0-9 and A-F are valid. Lower case letters are converted to upper case. The replacement causes the hexadecimal value of the character at that position to be changed. This change will be reflected in the text section of the line. If the cursor is positioned over the text portion of the line, no conversion is done and all characters are valid. The hexadecimal representation of the character will be changed in the hex section.

In text mode the status line shows the row and column of the cursor in the file, where column 1 starts at the left edge of the screen. In hex mode the offset in bytes from the beginning of the file is shown instead. The offset will increment by one for every two hex characters on the line, until the cursor reaches the text section. Then it will increase normally until it reaches the end of the text section.

Some default keys will work differently in Hexadecimal mode; most notably, you cannot insert or delete characters in hex mode. The full list of changed keys is outlined below.

Cursor Left
Moves the cursor left one character, unless the cursor would move to a non-modifiable section of the line. If so, it moves to the end of the previous modifiable section. The cursor will remain in either the hexadecimal or text portion of the screen; when the left edge of either section is reached the cursor is moved to the right edge of the same section, on the previous line.
Cursor Right
Moves the cursor right one character, unless the cursor would move to a non-modifiable section of the line. If so, it moves to the left edge of the next modifiable section. The cursor will remain in either the hexadecimal or text portion of the screen; when the right edge of either section is reached the cursor is moved to the left edge of the same section, on the next line.
Delete
Does nothing.
End
Moves the cursor to the right edge of the text view area.
Home
Moves the cursor to the left edge of the first hexadecimal input area.
Insert
Does nothing.
Tab
Moves the cursor to the beginning of the next input section on a line.
Shift-tab
Moves the cursor to the beginning of the previous input section on a line.
Ctrl-Backspace
Does nothing.
Ctrl-Cursor Left
Moves the cursor to the beginning of the previous input section on a line.
Ctrl-Cursor Right
Moves the cursor to the beginning of the next input section on a line.
Ctrl-Enter
Does nothing.
Alt-7
Does nothing.
Alt-8
Does nothing.