Programming Guide



sm_shrink_to_fit

Removes trailing empty array elements and shrinks the screen

void sm_shrink_to_fit(void);

Description

sm_shrink_to_fit lets you dynamically reduce the current screen size according to the number of array elements that contain data at runtime. This function removes the trailing elements in all arrays on a screen and then shrinks the screen to a size just large enough to accommodate the displayed data. If there is no data in the array, then the entire array is removed. Only the currently displayed copy of the screen in memory is altered.

sm_shrink_to_fit never minimizes screen size at the expense of the screen's first or last line. For example, given a five-line screen with a five-element array in which only four elements have data, sm_shrink_to_fit leaves the last empty element alone because it occupies the screen's last line.

Example

/* Put ^shrink in the auto control */
/* to have window shrink to fit before */
/* user gets a chance to see it! */

int
shrink(ignored_data)
char *ignored_data;
{
sm_shrink_to_fit();
return (0);
}