-->
Previous Table of Contents Next


xterm

Slackware’s xterm is the same program as Red Hat’s New Shell command (nxterm). xterm is a common X Windows application that simulates a common video terminal such as the DEC vt100. When you start an xterm session, you can run any command-line program or execute any Linux command just as you do on any of the virtual terminals supplied by Linux. Figure 22.6 illustrates an xterm session.


Fig. 22.6  xterms provide convenient access to a command-line shell.

The xterm program is a terminal emulator for the X Windows system. It provides terminals compatible with DEC vt102 and Tektronix 4014 for programs that can’t use the window system directly. If the underlying operating system supports terminal resizing capabilities, xterm uses the facilities to notify programs running in the window whenever it’s resized.

The vt102 and Tektronix 4014 terminals each have their own window, so you can edit text in one and look at graphics in the other at the same time. To maintain the correct aspect ratio—the height of the screen in pixels divided by the width of the screen in pixels—Tektronix graphics are restricted to the largest box with a Tektronix 4014 aspect ratio that fits in the window. This box is located in the upper-left area of the window.

Although the text and graphics windows may be displayed at the same time, the window containing the text cursor is considered the “active” window for receiving keyboard input and terminal output. The active window can be chosen through escape sequences, the vt Options menu in the vt102 window, and the Tek Options menu in the 4014 window.

Emulations

$TERMCAP entries that work with xterm include xterm, vt102, vt100, and ANSI. The $TERMCAP environment variable specifies the type of terminal your system emulates. xterm automatically searches the termcap database file in this order for these entries and then sets the TERM and $TERMCAP environment variables.


NOTE:  For more information on the termcap entries and the escape sequences supported, see the man page for termcap.

Many of the special xterm features may be modified under program control through a set of escape sequences different from the standard vt102 escape sequences.

The Tektronix 4014 emulation is also fairly good. Four different font sizes and five different line types are supported. The Tektronix text and graphics commands are recorded internally by xterm and may be written to a file by sending the Tektronix COPY escape sequence.

Other xterm Features

xterm automatically selects the text cursor when the pointer enters the window and deselects it when the pointer leaves the window. If the window is the focus window, the text cursor is selected no matter where the pointer is.

In vt102 mode are escape sequences to activate and deactivate an alternate screen buffer, which is the same size as the display area of the window. When activated, the current screen is saved and replaced with the alternate screen. Saving lines scrolled off the top of the window is disabled until the normal screen is restored. The termcap entry for xterm allows the visual editor vi to switch to the alternate screen for editing and to restore the screen on exit.

In vt102 or Tektronix mode are escape sequences to change the name of the windows.

Mouse Usage with xterm

When the vt102 window is created, xterm lets you select text and copy it within the same or other windows.

The selection functions are invoked when the pointer buttons are used with no modifiers, and when they’re used with the <Shift> key. The assignment of the functions to keys and buttons may be changed through the resource database.

Mouse Button1 (usually the left button) is used to save text into the cut buffer. Move the cursor to the beginning of the text and then press the button while moving the cursor to the end of the region and then release the button. The selected text is highlighted and saved in the global cut buffer. This selected text is then made the primary selection when the button is released. Double-clicking selects entire words, triple-clicking selects lines, quadruple-clicking goes back to characters, and so on.

Mouse Button2 (usually the middle button) pastes the text from the primary selection, if any. Otherwise, text is inserted from the cut buffer, inserting it as keyboard input.

By cutting and pasting pieces of text without trailing new lines, you can take text from several places in different windows and form a command to the shell, for example, or take output from a program and insert it into your favorite editor. Because the cut buffer is shared globally among different applications, you should regard it as a file whose contents you know. The terminal emulator and other text programs should be treating the cut buffer as if it were a text file—that is, the text is delimited by new lines.

The scroll region within the window displaying the xterm displays the position and amount of text now showing in the window relative to the amount of text actually saved. As more text is saved (up to the system-determined maximum), the size of the highlighted area decreases.

Clicking Button1 with the pointer in the scroll region moves the next line to the top of the display window. Clicking Button2 moves the display to a position in the saved text that corresponds to the pointer’s position in the scrollbar. Clicking Button3 moves the top line of the display window down to the pointer position.

Unlike the vt102 window, the Tektronix window doesn’t allow text to be copied. It does, however, allow Tektronix GIN mode, in which the cursor changes from an arrow to a cross. Pressing any key sends that key and the current coordinate of the cross cursor. Clicking Button1, Button2, or Button3 returns the letters l, m, and r, respectively. If the <Shift> key is pressed when a button is pressed, the corresponding uppercase letter is sent. To distinguish a pointer button from a key, the high bit of the character is set.


Previous Table of Contents Next