.\" Copyright (c) 1980 The Regents of the University of California.
.\" Redistribution and use in source and binary forms are permitted
.\" provided that the above copyright notice and this paragraph are
.\" duplicated in all such forms and that any documentation,
.\" advertising materials, and other materials related to such
.\" distribution and use acknowledge that the software was developed
.\" by the University of California, Berkeley. The name of the
.\" University may not be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\" @(#)intro.3 6.2 (Berkeley) 3/17/89
This is a description of how to actually use the screen package.
In it, we assume all updating, reading, etc.
All instructions will work on any window,
with changing the function name and parameters as mentioned above.
In order to use the screen package,
the routines must know about terminal characteristics,
These functions are performed by
Since it must allocate space for the windows,
it can overflow core when attempting to do so.
On this rather rare occasion,
be called before any of the routines which affect windows are used.
the program will core dump as soon as either
However, it is usually best to wait to call it
until after you are sure you will need it,
like after checking for startup errors.
Terminal status changing routines
Now that the screen windows have been allocated,
you can set them up for the run.
If you want to, say, allow the window to scroll,
If you want the cursor to be left after the last change, use
will move the cursor to the window's current \*y after updating it.
New windows of your own can be created, too, by using the functions
will allow you to get rid of old windows.
If you wish to change the official size of the terminal by hand,
This is best done before,
but can be done either before or after,
as it will always delete any existing
before creating new ones.
Now that we have set things up,
we will want to actually update the terminal.
used to change what will go on a window are
adds a character at the current \*y,
returning ERR if it would cause the window to illegally scroll,
printing a character in the lower right-hand corner
of a terminal which automatically scrolls
if scrolling is not allowed.
changes the current \*y to whatever you want them to be.
It returns ERR if you try to move off the window when scrolling is not allowed.
As mentioned above, you can combine the two into
to do both things in one fell swoop.
The other output functions,
to add characters to the window.
After you have put on the window what you want there,
when you want the portion of the terminal covered by the window
to be made to look like it,
In order to optimize finding changes,
assumes that any part of the window not changed
of that window has not been changed on the terminal,
that you have not refreshed a portion of the terminal
with an overlapping window.
are provided to make it look like a desired part of window has been changed,
check that whole subsection of the terminal for changes.
it will make the screen look like
This is useful for implementing a command
which would redraw the screen in case it get messed up.
Input is essentially a mirror image of output.
The complementary function to
Since the screen package needs to know what is on the terminal at all times,
if characters are to be echoed,
the tty must be in raw or cbreak mode.
and then reads in the character.
All sorts of fun functions exists for maintaining and changing information
the descriptions in section 5.4. should suffice.
In order to do certain optimizations,
before the screen routines start up.
These functions are performed in
In order to clean up after the routines,
It restores tty modes to what they were
anytime after the call to initscr,
should be called before exiting.