Q:

Problems using newpad with a size larger than the screen

I'm trying to scroll some text larger than the screen.
The docs say newpad is not limited by the screen size, but initiating it with values greater than the terminal available columns or lines fails to print anything:
newpad(LINES + 1, COLS); // fails
newpad(LINES, COLS); // works

Entire code for reference:
extern crate ncurses;
use ncurses::*;

fn main() {
    initscr();
    start_color();
    use_default_colors();
    cbreak();
    noecho();
    curs_set(CURSOR_VISIBILITY::CURSOR_INVISIBLE);

    let pad = newpad(1000, COLS);

    refresh();
    let mut x = 0;
    while x < 1000 {
        x += 1;
        wprintw(pad, &format!("Line number {}\n", x));
    }
    prefresh(pad, 0, 0, 0, 0, LINES, COLS);
    getch();
    endwin();
}

A:

The behavior is a bit odd.
If the number of lines or rows is greater than the viewport, the last two prefresh arguments must be at most LINES - 1 and COLS - 1 respectively:
prefresh(pad, 0, 0, 0, 0, LINES - 1, COLS - 1);

If it's less, there's no need to subtract 1, as the code will work as expected.

