The TextView Window


xv now has the ability to display arbitrary text data. While there are several different ways to cause a TextView window to appear, (such as opening an unrecognized type of file, using the Text view command in the Visual Schnauzer, or the TextView, Comments, or License commands in the xv controls window) all of the windows behave the same.

The TextView window has two primary modes of operation. It can display data as ASCII text, or it can display data in hexadecimal format.

There are a total of two TextView windows available. One is reserved for the Comments command. The other is used for all other text data.

As you might suspect, you can scroll the TextView windows by using the mouse in the scroll bars (as described in "Operating a List Window"). Likewise, you can scroll the window around using the arrow keys on your keyboard, the <PageUp> and <PageDown> keys (sometimes labeled <Prev> and <Next> ) and the <Home> and <End> keys. It behaves as you would expect.

You can switch modes by pressing the nice friendly Ascii and Hex buttons. Close (or pressing <Esc>) will close the TextView window.


This is the default mode for the TextView windows. It will display text of any width and length. The only limitation is that all of the text must fit into memory. If it doesn't, you'll get an appropriate error message, and the text will not be displayed.

TextView windows are resizable. When you change the size of the main window, the inner text display window will change size appropriately, and display more (or less) data. While the default size of all TextView windows (except for the Comments window) is 80 characters wide by 24 lines high, there is nothing magical about these numbers. They're only chosen out of a sense of tradition.

When in ASCII mode, the TAB character (ctrl-I) and the NL character (ctrl-J) are interpreted as is normal on a UNIX system (e.g. tab stops every 8 characters, NL marks end of line). The CR character (ctrl-M) is not displayed.

All other control characters (characters with an ASCII value less than '32') are displayed with a caret (^) and the appropriate upper-case letter. For example, character number 17 (decimal) will be displayed as '^Q'.

All characters with an ASCII value greater than 127 are displayed as octal numbers with a leading backslash. As an example, character number 128 (decimal) will display as '\'.

All other characters are displayed with the appropriate standard glyph.

Hex Mode

This mode is useful for displaying binary data. In fact, if you have some binary data to display, you might want to start up xv just to display it, as this mode beats the heck out of using the standard UNIX command 'od -ha'.

The data is shown 16 bytes to a line. The first number on each line is the offset (in hex) from the beginning of the file. This is followed by 16 bytes, shown in hex, and then in ASCII. Bytes which have a value less than 0x20 or greater than 0x7f are shown as a '.' in the ASCII section.

While you can resize the window while in Hex mode, changing the width will not be of any use, as the output is formatted for an 80 character wide TextView window. Making the window wider will just put unused space on the right side. Making the window narrower will just enable the horizontal scroll bar. Changing the height of the window may prove useful, however.

The Comment Window

The xv comments window (opened by the Comments command in the xv controls window) operates in exactly the same way as the TextView window. You can even display image comments in Hex mode, though that doesn't sound all that useful.

The xv comments window displays any comments found in the currently-loaded image file. If there are no comments, the window will be empty. Note that only certain image formats support comment fields (GIF89, JPEG, TIFF, and PBM/PGM/PPM are the most likely formats to have comments).

Whenever a new image is loaded, the xv comments window is updated to reflect the new image comments, or lack thereof.

Whenever you save an image in a format that supports comments, the comments from the last loaded image will be written out as well. This lets you read a file (say a GIF) which has comments, and write it out in another format (say, JPEG) preserving the comments.

Currently, xv does not give you a way to directly edit the image comments. Given how few images actually have comments in them, it seemed like a lot of work for very little gain. (Yeah, I know, if something actually let you edit the comments, perhaps people would start entering some...) Whatever. Seems likely enough that this feature will make it into a future version of xv. Of course, that's exactly what I said in the 3.00 documentation, a year and a half ago, so you may want to take that statement with a grain of salt...

Until then, if you really want to add or edit the comments in an image file, write it out as a PBM/PGM/PPM file. This format has a plain-text header (comments simply begin with a '#' character, which is not part of the comment), and you can edit it very easily with emacs, or any other reasonable text editor. Once that's done, you can use xv to convert the file back into the desired format.