Programming Guide


Removes trailing empty array elements and shrinks the screen

void sm_shrink_to_fit(void);


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.


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

char *ignored_data;
return (0);