In this chapter, we discover the advantages of
xterms compared with visual display units.
In the olden days, before workstations were widely available, Unix users
used visual display units (VDUs).
Here is a view of a typical VDU screen:
VDUs had room for only 24 lines of text and each line had 80 characters. The screens all had black backgrounds and all the text was one colour, usually white, green or orange. There were no facilities for copying or pasting. Each Unix user could use just one VDU at once so the 24 lines provided the user's only view of Unix. There were no facilities for scrolling back to review text that had disappeared off the top of the screen. All characters on the screen were the same size and most VDUs could only display text. One of the most widely used VDUs was the DEC VT102.
A workstation is a fairly expensive device designed for displaying graphics on a screen; it has a keyboard and a mouse as well as one or more screens. Personal computers (PCs) are not workstations because the screens are generally too small and the graphics capability is usually not good enough. However, PCs do offer the same kind of windowing and graphics as workstations. Programs such a Vista Exceed allow PCs to emulate low quality workstations.
The two programs which are the most use to a
workstation user are:
is the modern version of the old VDU;
it emulates one VT102 in each window in which it is executed.
However, it has some
extra features which make it much better than a real VT102.
A window manager is the program that allows us to create, destroy, move and re-size windows. It allows each user to use as many windows as he or she wishes simultaneously. It is always waiting, behind the scenes, to change our windows for us. Most people do not know they are using a window manager because it is built into desktops such as Microsoft Windows, Gnome, KDE and CDE. Some people simply use a window manager instead of a desktop. Personally, I dislike desktops as they all feel like Microsoft Windows and are nearly as annoying to use. I use Window Maker to manage my on-screen work-spaces.
Here is one of my work-spaces:
As you see, I have three
Two of them are VDU-sized and one is larger.
The blue frames with titles are put around the
xterms by Window Maker so they can be moved and re-sized.
The currently active
has a white title
and a solid magenta typing cursor.
I choose to use black backgrounds and white text because that is easier to read. The whole world got it wrong when it followed Apple into white backgrounds. White paper wouldn't be as easy to read if it glowed in the dark.
It is important to stress that this chapter is about genuine
This is because they have a very simple, elegant method for copying text
and inserting it into another window.
This method is better than Microsoft's which was developed later.
because they meet Microsoft's way first, many people can't appreciate the
There are about a hundred VDU emulation programmes available today but most
have adopted the inferior Microsoft technique, which is my reason for sticking
It is possible that many of the other terminal types can be configured to work
but only the original article works so well "out of the box".
The first extra
feature is different sized fonts.
If you find the characters in the
either too small or too large for comfort, you can change the font
To do this you move the mouse cursor over the
xterm, hold down the control key, press the
and hold it down.
This causes a
of font names such as
there should be a tick by the currently selected font name.
the mouse cursor down the menu
and release it at the font you wish to select.
The size of the characters should change more or less instantly and
xterm's window should automatically be re-sized to suit the new font.
font is being
switched to the
Notice that the menu always uses the default font size (unless your
is set up in a
The second advantage of
xterms is that they can be scrolled to view thousands of lines of recent history.
is relatively up to date, and your window manager is properly configured,
the simplest way of scrolling is to use the
If there are very many lines available for scrolling, using the mouse wheel might be too tedious and it would then be better to use the scrollbar. Contrary to modern practice, this is at the left-hand side of the screen by default.
Here is an
with the scrollbar indicated by
the green arrow:
xterm1.png: 499 x 316 The red arrow points to a slider or thumbwheel which shrinks as more text is displayed. You can tell at a glance whether you have enough text to scroll by looking at the scrollbar. If it is a solid block of half-tone colour you haven't enough text. If it is in two or three parts, some in the
xterm's background colour and some in half-tone colour,
then you can scroll.
Our scrollbar is showing us that we are at the end of the displayable
text, and that we could scroll backwards.
The simplest way of scrolling via the scrollbar is with the
To position the slider half way through the text,
you place the mouse cursor half way down the scrollbar
and click the
button of the mouse.
will scroll instantaneously to the desired position.
After you have scrolled, the slider will be further up the scrollbar.
If your mouse only has two buttons, you have to simulate pressing the middle button by pressing the left and right buttons simultaneously.
You can also position the slider manually by putting the mouse cursor over the slider and dragging it to a new position with the middle mouse button.
There is another way of scrolling that gives you fine control over the amount of scrolling; it uses the left and right mouse buttons over the scrollbar. To scroll backwards, towards earlier lines, you put the mouse cursor in the scrollbar area and click the right mouse button. To scroll back further, you click the right button again. To scroll forwards, towards the last line, you click the left mouse button.
for left and right clicks
depends on the cursor's position in the scrollbar.
If it is at the bottom,
scrolls by a whole screenful;
if it is right at the top,
scrolls one line.
The amount is proportional to the distance of the mouse cursor from the top
of the scrollbar.
When you have scrolled backwards, you do not have to scroll forwards to
get to the last line to continue typing.
All you have to do is press a key - even the space bar - and the
will scroll instantaneously to the last line.
We often have to type the same commands or words repeatedly.
we can make this a little easier by
copying text already on the screen onto the last line.
We can copy as much or a little as we wish.
The job is done in two halves: selecting the text to be copied and
inserting the text.
The easiest way of selecting text is to put the mouse cursor in the middle of
a word and
The word should be then highlighted in reverse video.
Here the user has double-clicked somewhere in "selecting":
If you wish to select several words, the simplest way is to select
the first word in usual way, and then to click the
in the middle of the last word.
the original selection to cover all the words from the first to the last.
Here the user has right-clicked somewhere in "cursor":
You can right-click again and again.
Here the user has right-clicked in "appears":
Notice that the highlighted area now stretches to the right-hand edge of the screen. The area between the last character on the line and the side of the
represents the newline character at the end of the line.
can be pasted as well as text.
However, be careful when pasting commands: if you selected the newline after a
command, the command will be executed without you having time to reconsider it!
You can extend the selection up the screen too.
Here the user has right-clicked on "We":
There are now sixteen and a half lines of text selected including two blank ones.
You can select from a particular word to the end of the line by
clicking the left button in the word.
Here the user treble clicked on "The".
You can select any amount of text by dragging the mouse cursor through the
text with the left button.
This is the Microsoft method referred to earlier;
it is bit of a drag compared with just clicking -
but sometimes we have no option:
This is the only way to select "red - eve" from the screen shown.
To select more than a screenful of text, we have to use scrolling as well.
The way to do this is to select the first word (by double-clicking)
and then scroll down to the last word.
Don't worry that the highlighted first word will disappear off the top
of the window;
even though it is out of sight, it remains the current
Lastly we extend the X selection by right-clicking on the last
word we want to select.
The X selection now covers several screens full of text.
Of course, we don't have to select from top to bottom. We could select the last word first, and scroll up towards the first.
This method of selecting more than a screenful sounds complicated but it is far easier than the Microsoft method - which usually involves messing about as you undershoot and overshoot while text whizzes past in the window.
Pasting is not really the correct word for what
Pasting implies that you can do it anywhere.
Inserting is performed by clicking the
in the window.
The selected text is inserted where the keyboard cursor is - regardless
of where the mouse cursor is in the text.
Here we have selected two words separated by spaces:
and the user has inserted the selection twice on the command line by middle-clicking twice. Notice that the system is waiting for the user to press the enter (newline) key -- or erase the bad command.
Here the selection is still one line but this time it includes the newline
When the user middle-clicked, the system did not wait for the enter key. It tried to execute "vdu.text" as a command.
Inserting many lines is no problem but it has to be done while the system is expecting many lines. For example an email could be pasted into a text box in a browser to post it via gmail. In this case, paste is the correct word as the text would go wherever the user indicated by middle clicking. A common error is inserting a mult-line selection when the system is expecting a one line command.
The "shift" and "insert" keys can usually be used together instead of a middle click. This is convenient when you wish to use the X selection as part of text that is being entered via the keyboard.
You might find that
pressing a key does not make
scroll to the last line.
treble-clicking selects too much text - perhaps it always starts at
the beginning of the line or it always includes the newline character.
If any of these occur,
it is because your system manager has chosen
different options to me.
You can select some of the options yourself from other
Other options can only be corrected by setting up the
in Appendix ??.
The other menus are obtained by holding down the control key and pressing
the left or middle mouse buttons.
menu associated with the middle button is the most useful:
As you see, you can select
Scroll to Bottom on Key Press
you can even remove the scrollbar altogether.
xterm's options are available in menus.
the scrollbar can be made to appear on the right.
However, that has to be done at the command line when the
is first started.
Unfortunately, you would have to do it every time you started one.
The more permanent solution is to set up an
file, or put the
command line in a shell script (see chapter??).
The best thing about the X Window System is that absolutely everything about it can be tailored - even the menus. For example, in Microsoft Windows we cannot choose how keyboard input is associated with a window - you have to click the left mouse button in the window. And when you do, the window is automatically brought to the top of any other windows. In X we can choose both: how to give focus to a window, and whether it is raised to the top or not. All tailoring is done by editing ordinary text files.