HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)
c
curses_intro(3X) curses_intro(3X)
(X/Open CURSES)
Window Background
Each window has a background property. The background property specifies:
• A spacing complex character (the background character) that will be used in a variety of situa-
tions where visible information is deleted from the screen.
• A rendition to use in displaying the background character in those situations, and in other
situations specified in Rendition of Characters Placed into a Window in curses_intro.
Conceptual Operations
Screen Addressing
Many Curses functions use a coordinate pair. In the DESCRIPTION, coordinate locations are
represented as (y, x) since the y argument always precedes the x argument in the function call. These
coordinates denote a line/column position, not a character position.
The coordinate y always refers to the row (of the window), and x always refers to the column. The first
row and the first column is number 0, not 1. The position (0, 0) is the window’s origin .
For example, for terminals that display the ISO 8859-1 character set (with left-to-right writing), (0, 0)
represents the upper left-hand corner of the screen.
Functions that start with mv take arguments that specify a (y, x) position and move the cursor (as though
move() were called) before performing the requested action. As part of the requested action, further
cursor movement may occur, specified on the respective reference manual page.
Basic Character Operations
Adding (Overwriting)
The Curses functions that contain the word add, such as
addch(), actually specify one or more charac-
ters to replace (overwrite) characters already in the window. If these functions specify only non-spacing
characters, they are appended to a spacing character already in the window; see also Non-spacing Char-
acters (ENHANCED CURSES).
When replacing a multi-column character with a character that requires fewer columns, the new charac-
ter is added starting at the specified or implied column position. All columns that the former multi-
column character occupied that the new character does not require are orphaned columns, which are
filled using the background character and rendition.
Replacing a character with a character that requires more columns also replaces one or more subsequent
characters on the line. This process may also produce orphaned columns.
Truncation, Wrapping and Scrolling
If the application specifies a character or a string of characters such that writing them to a window would
extend beyond the end of the line (for example, if the application tries to deposit any multi-column char-
acter at the last column in a line), the behaviour depends on whether the function supports line wrap-
ping:
• If the function does not wrap, it fails.
• If the function wraps, then it places one or more characters in the window at the start of the
next line, beginning with the first character that would not completely fit on the original line.
If the final character on the line is a multi-column character that does not completely fit on the line,
the entire character wraps to the next line and columns at the end of the original line may be
orphaned.
If the original line was the last line in the window, the wrap may cause a scroll to occur:
— If scrolling is enabled, a scroll occurs. The contents of the first line of the window are
lost. The contents of each remaining line in the window move to the previous line. The
last line of the window is filled with any characters that wrapped. Any remaining space
on the last line is filled with the background character and rendition.
— If scrolling is disabled, any characters that would extend beyond the last column of the
last line are truncated.
The
scrollok() function enables and disables scrolling.
Some add functions move the cursor just beyond the end of the last character added. If this position is
beyond the end of a line, it causes wrapping and scrolling under the conditions specified in the second
bullet above.
HP-UX 11i Version 2: September 2004 − 7 − Hewlett-Packard Company Section 3−−173