The mvprintw
function first attempts to move the cursor to the indicated position, e.g., with wmove
. The wmove
function never causes scrolling, and the attempt to move it past the bottom line of the window fails (quoting from wmove
manual):
These routines return ERR upon failure and OK (SVr4 specifies only "an integer value other than ERR") upon successful completion.
Specifically, they return an error if the window pointer
is null, or if the position is outside the window.
Instead, to do scrolling you must write text with a newline character (i.e., '\n'
) at the bottom of the window. wprintw
is useful; in turn it calls waddch
(quoting from the latter's manual):
The addch, waddch, mvaddch and mvwaddch routines put the
character ch into the given window at its current window
position, which is then advanced. They are analogous to
putchar in stdio(3). If the advance is at the right margin:
...
At the bottom of the current scrolling region, and if
scrollok is enabled, the scrolling region is scrolled
up one line.
If ch is a tab, newline, or backspace, the cursor is moved appropriately within the window:
...
Newline does a clrtoeol, then moves the cursor to the
window left margin on the next line, scrolling the
window if on the last line.