示例#1
0
static void
help2(void)
/* keystroke help screen */
{
    (void) waddstr(helpwin, "Possible moves are shown with `-'.\n\n");

    (void) waddstr(helpwin, "You can move around with the arrow keys or\n");
    (void) waddstr(helpwin, "with the rogue/hack movement keys.  Other\n");
    (void) waddstr(helpwin, "commands allow you to undo moves or redraw.\n");
    (void) waddstr(helpwin, "Your mouse may work; try left-button to\n");
    (void) waddstr(helpwin, "move to the square under the pointer.\n\n");

    (void) waddstr(helpwin, "x,q -- exit             y k u    7 8 9\n");
    (void) waddstr(helpwin, "r -- redraw screen       \\|/      \\|/ \n");
    (void) waddstr(helpwin, "bksp -- undo move       h-+-l    4-+-6\n");
    (void) waddstr(helpwin, "a -- autojump            /|\\      /|\\ \n");
    (void) waddstr(helpwin, "                        b j n    1 2 3\n");

    (void) waddstr(helpwin, "\nYou can place your knight on the selected\n");
    (void) waddstr(helpwin, "square with spacebar, Enter, or the keypad\n");
    (void) waddstr(helpwin, "center key.  Use F/B to review the path.\n");

    MvWAddStr(helpwin, NOTIFYY - INSTRY, 0,
	      "Press `?' to go to game explanation");
}
示例#2
0
static void
introTest(WINDOW *win)
{
    wmove(win, height / 2 - 5, width / 2);
    wvline(win, ACS_VLINE, 10);
    wmove(win, height / 2, width / 2 - 10);
    whline(win, ACS_HLINE, 20);
    Continue(win);

    beep();
    werase(win);

    box(win, ACS_VLINE, ACS_HLINE);
    wrefresh(win);
    cbreak();
    MvWAddStr(win, 1, 1,
	      "You should have rectangle in the middle of the screen");
    MvWAddStr(win, 2, 1, "You should have heard a beep");
    Continue(win);
    return;
}
示例#3
0
static void
scrollTest(WINDOW *win)
{
    int i;
    int half;
    int OldY;
    NCURSES_CONST char *Message = "The window will now scroll slowly";

    wclear(win);
    OldY = getmaxy(win);
    half = OldY / 2;
    MvWAddStr(win, OldY - 2, 1, Message);
    wrefresh(win);
    scrollok(win, TRUE);
    for (i = 1; i <= OldY; i++) {
	napms(600);
	scroll(win);
	wrefresh(win);
    }

    werase(win);
    for (i = 1; i < OldY; i++) {
	MvWPrintw(win, i, 1, "Line %d", i);
    }
    MvWPrintw(win, OldY - 2, 1, "The top of the window will scroll");
    wmove(win, 1, 1);
    wsetscrreg(win, 0, half - 1);
    box(win, ACS_VLINE, ACS_HLINE);
    wrefresh(win);
    for (i = 1; i <= half; i++) {
	napms(600);
	scroll(win);
	box(win, ACS_VLINE, ACS_HLINE);
	wrefresh(win);
    }

    werase(win);
    for (i = 1; i < OldY; i++) {
	MvWPrintw(win, i, 1, "Line %d", i);
    }
    MvWPrintw(win, 1, 1, "The bottom of the window will scroll");
    wmove(win, OldY - 2, 1);
    wsetscrreg(win, half, --OldY);
    box(win, ACS_VLINE, ACS_HLINE);
    wrefresh(win);
    for (i = half; i <= OldY; i++) {
	napms(600);
	wscrl(win, -1);
	box(win, ACS_VLINE, ACS_HLINE);
	wrefresh(win);
    }
    wsetscrreg(win, 0, OldY);
}
示例#4
0
/*
 * Test sub windows
 */
static int
SubWinTest(WINDOW *win)
{
    int w, h, sw, sh, bx, by;
    WINDOW *swin1, *swin2, *swin3;

    getmaxyx(win, h, w);
    getbegyx(win, by, bx);
    sw = w / 3;
    sh = h / 3;
    if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL)
	return 1;
    if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL)
	return 1;
    if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL)
	return 1;

    set_colors(swin1, 8, COLOR_RED, COLOR_BLUE);
    werase(swin1);
    MvWAddStr(swin1, 0, 3, "Sub-window 1");
    wrefresh(swin1);

    set_colors(swin2, 9, COLOR_CYAN, COLOR_MAGENTA);
    werase(swin2);
    MvWAddStr(swin2, 0, 3, "Sub-window 2");
    wrefresh(swin2);

    set_colors(swin3, 10, COLOR_YELLOW, COLOR_GREEN);
    werase(swin3);
    MvWAddStr(swin3, 0, 3, "Sub-window 3");
    wrefresh(swin3);

    delwin(swin1);
    delwin(swin2);
    delwin(swin3);
    WaitForUser(win);
    return 0;
}
示例#5
0
static void
Continue(WINDOW *win)
{
    int y1 = getmaxy(win);
    int x1 = getmaxx(win);
    int y0 = y1 < 10 ? y1 : 10;
    int x0 = 1;
    chtype save;

    save = mvwinch(win, y0, x1 - 1);

    MvWAddStr(win, y0, x0, " Press any key to continue");
    wclrtoeol(win);
    getyx(win, y0, x0);

    MvWAddCh(win, y0, x1 - 1, save);

    wmove(win, y0, x0);
    raw();
    wgetch(win);
}
示例#6
0
static void
help1(void)
/* game explanation -- initial help screen */
{
    (void) waddstr(helpwin, "Knight's move is a solitaire puzzle.  Your\n");
    (void) waddstr(helpwin, "objective is to visit each square of the  \n");
    (void) waddstr(helpwin, "chessboard exactly once by making knight's\n");
    (void) waddstr(helpwin, "moves (one square right or left followed  \n");
    (void) waddstr(helpwin, "by two squares up or down, or two squares \n");
    (void) waddstr(helpwin, "right or left followed by one square up or\n");
    (void) waddstr(helpwin, "down).  You may start anywhere.\n\n");

    (void) waddstr(helpwin, "Use arrow keys to move the cursor around.\n");
    (void) waddstr(helpwin, "When you want to move your knight to the \n");
    (void) waddstr(helpwin, "cursor location, press <space> or Enter.\n");
    (void) waddstr(helpwin, "Illegal moves will be rejected with an  \n");
    (void) waddstr(helpwin, "audible beep.\n\n");
    (void) waddstr(helpwin, "The program will detect if you solve the\n");
    (void) waddstr(helpwin, "puzzle; also inform you when you run out\n");
    (void) waddstr(helpwin, "of legal moves.\n\n");

    MvWAddStr(helpwin, NOTIFYY - INSTRY, 0,
	      "Press `?' to go to keystroke help.");
}
示例#7
0
static void
test_adds(int level)
{
    static bool first = TRUE;

    int ch;
    int limit;
    int row = 1;
    int col;
    int row2, col2;
    int length;
    char buffer[BUFSIZ];
    WINDOW *look = 0;
    WINDOW *work = 0;
    WINDOW *show = 0;
    int margin = (2 * MY_TABSIZE) - 1;
    Options option = (Options) ((unsigned) (m_opt
                                            ? oMove
                                            : oDefault)
                                | (unsigned) ((w_opt || (level > 0))
                                        ? oWindow
                                        : oDefault));

    if (first) {
        static char cmd[80];
        setlocale(LC_ALL, "");

        putenv(strcpy(cmd, "TABSIZE=8"));

        initscr();
        (void) cbreak();	/* take input chars one at a time, no wait for \n */
        (void) noecho();	/* don't echo input */
        keypad(stdscr, TRUE);
    }

    limit = LINES - 5;
    if (level > 0) {
        look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1);
        work = newwin(limit - 2, COLS - (2 * level), 1, level);
        show = newwin(4, COLS, limit + 1, 0);
        box(look, 0, 0);
        wnoutrefresh(look);
        limit -= 2;
    } else {
        work = stdscr;
        show = derwin(stdscr, 4, COLS, limit + 1, 0);
    }
    keypad(work, TRUE);

    for (col = margin + 1; col < COLS; col += MY_TABSIZE)
        MvWVLine(work, row, col, '.', limit - 2);

    MvWVLine(work, row, margin, ACS_VLINE, limit - 2);
    MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2);
    limit /= 2;

    MvWAddChStr(work, 1, 2, ChStr("String"));
    MvWAddChStr(work, limit + 1, 2, ChStr("Chars"));
    wnoutrefresh(work);

    buffer[length = 0] = '\0';
    legend(show, level, option, buffer, length);
    wnoutrefresh(show);

    doupdate();

    /*
     * Show the characters added in color, to distinguish from those that
     * are shifted.
     */
    if (has_colors()) {
        start_color();
        init_pair(1, COLOR_WHITE, COLOR_BLUE);
        show_attr = (attr_t) COLOR_PAIR(1);
        wbkgdset(work, show_attr | ' ');
    } else {
        show_attr = A_STANDOUT;
    }

    while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
        wmove(work, row, margin + 1);
        switch (ch) {
        case key_RECUR:
            test_adds(level + 1);

            touchwin(look);
            touchwin(work);
            touchwin(show);

            wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);

            doupdate();
            break;
        case key_NEWLINE:
            if (row < limit) {
                ++row;
                /* put the whole string in, all at once */
                col2 = margin + 1;
                switch (option) {
                case oDefault:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            if (move(row, col2) != ERR) {
                                AddNStr(ChStr2(buffer + col), LEN(col));
                            }
                        }
                    } else {
                        if (move(row, col2) != ERR) {
                            AddStr(ChStr2(buffer));
                        }
                    }
                    break;
                case oMove:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            MvAddNStr(row, col2, ChStr2(buffer + col), LEN(col));
                        }
                    } else {
                        MvAddStr(row, col2, ChStr2(buffer));
                    }
                    break;
                case oWindow:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            if (wmove(work, row, col2) != ERR) {
                                WAddNStr(work, ChStr2(buffer + col), LEN(col));
                            }
                        }
                    } else {
                        if (wmove(work, row, col2) != ERR) {
                            WAddStr(work, ChStr2(buffer));
                        }
                    }
                    break;
                case oMoveWindow:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            MvWAddNStr(work, row, col2, ChStr2(buffer + col),
                                       LEN(col));
                        }
                    } else {
                        MvWAddStr(work, row, col2, ChStr2(buffer));
                    }
                    break;
                }

                /* do the corresponding single-character add */
                row2 = limit + row;
                for (col = 0; col < length; ++col) {
                    col2 = ColOf(buffer, col, margin);
                    switch (option) {
                    case oDefault:
                        if (move(row2, col2) != ERR) {
                            AddCh(UChar(buffer[col]));
                        }
                        break;
                    case oMove:
                        MvAddCh(row2, col2, UChar(buffer[col]));
                        break;
                    case oWindow:
                        if (wmove(work, row2, col2) != ERR) {
                            WAddCh(work, UChar(buffer[col]));
                        }
                        break;
                    case oMoveWindow:
                        MvWAddCh(work, row2, col2, UChar(buffer[col]));
                        break;
                    }
                }
            } else {
                beep();
            }
            break;
        case KEY_BACKSPACE:
            ch = '\b';
        /* FALLTHRU */
        default:
            if (ch <= 0 || ch > 255) {
                beep();
                break;
            }
            buffer[length++] = (char) ch;
            buffer[length] = '\0';

            /* put the string in, one character at a time */
            col = ColOf(buffer, length - 1, margin);
            switch (option) {
            case oDefault:
                if (move(row, col) != ERR) {
                    AddStr(ChStr2(buffer + length - 1));
                }
                break;
            case oMove:
                MvAddStr(row, col, ChStr2(buffer + length - 1));
                break;
            case oWindow:
                if (wmove(work, row, col) != ERR) {
                    WAddStr(work, ChStr2(buffer + length - 1));
                }
                break;
            case oMoveWindow:
                MvWAddStr(work, row, col, ChStr2(buffer + length - 1));
                break;
            }

            /* do the corresponding single-character add */
            switch (option) {
            case oDefault:
                if (move(limit + row, col) != ERR) {
                    AddCh(UChar(ch));
                }
                break;
            case oMove:
                MvAddCh(limit + row, col, UChar(ch));
                break;
            case oWindow:
                if (wmove(work, limit + row, col) != ERR) {
                    WAddCh(work, UChar(ch));
                }
                break;
            case oMoveWindow:
                MvWAddCh(work, limit + row, col, UChar(ch));
                break;
            }

            wnoutrefresh(work);

            legend(show, level, option, buffer, length);
            wnoutrefresh(show);

            doupdate();
            break;
        }
    }
    if (level > 0) {
        delwin(show);
        delwin(work);
        delwin(look);
    }
}
示例#8
0
static void
outputTest(WINDOW *win)
{
    WINDOW *win1;
    char Buffer[80];
    chtype ch;
    int by, bx;

#if !HAVE_TIGETSTR
#if HAVE_TGETENT
    char tc_buffer[4096];
    char tc_parsed[4096];
    char *area_pointer = tc_parsed;
    tgetent(tc_buffer, getenv("TERM"));
#else
#define tgetstr(a,b) 0
#endif
#endif /* !HAVE_TIGETSTR */

    nl();
    wclear(win);
    MvWAddStr(win, 1, 1,
	      "You should now have a screen in the upper left corner, and this text should have wrapped");
    mvwin(win, 2, 1);
    waddstr(win, "\nThis text should be down\n");
    waddstr(win, "and broken into two here ^");
    Continue(win);

    wclear(win);
    wattron(win, A_BOLD);
    MvWAddStr(win, 1, 1, "A new window will appear with this text in it");
    MvWAddStr(win, 8, 1, "Press any key to continue");
    wrefresh(win);
    wgetch(win);

    getbegyx(win, by, bx);

    if (LINES < 24 || COLS < 75) {
	MvWAddStr(win, 5, 1,
		  "Some tests have been skipped as they require a");
	MvWAddStr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS");
	Continue(win);
    } else {
	win1 = newwin(10, 50, 14, 25);
	if (win1 == NULL) {
	    endwin();
	    return;
	}
#ifdef A_COLOR
	if (has_colors()) {
	    init_pair(3, COLOR_BLUE, COLOR_WHITE);
	    wbkgd(win1, (chtype) COLOR_PAIR(3));
	} else
	    wbkgd(win1, A_NORMAL);
#else
	wbkgd(win1, A_NORMAL);
#endif
	wclear(win1);
	MvWAddStr(win1, 5, 1,
		  "This text should appear; using overlay option");
	copywin(win, win1, 0, 0, 0, 0, 9, 49, TRUE);

#if defined(PDCURSES) && !defined(XCURSES)
	box(win1, 0xb3, 0xc4);
#else
	box(win1, ACS_VLINE, ACS_HLINE);
#endif
	wmove(win1, 8, 26);
	wrefresh(win1);
	wgetch(win1);

	wclear(win1);
	wattron(win1, A_BLINK);
	MvWAddStr(win1, 4, 1,
		  "This blinking text should appear in only the second window");
	wattroff(win1, A_BLINK);
	mvwin(win1, by, bx);
	overlay(win, win1);
	mvwin(win1, 14, 25);
	wmove(win1, 8, 26);
	wrefresh(win1);
	wgetch(win1);
	delwin(win1);
    }

    clear();
    wclear(win);
    wrefresh(win);
    MvWAddStr(win, 6, 2, "This line shouldn't appear");
    MvWAddStr(win, 4, 2, "Only half of the next line is visible");
    MvWAddStr(win, 5, 2, "Only half of the next line is visible");
    wmove(win, 6, 1);
    wclrtobot(win);
    wmove(win, 5, 20);
    wclrtoeol(win);
    MvWAddStr(win, 8, 2, "This line also shouldn't appear");
    wmove(win, 8, 1);
    wdeleteln(win);
    Continue(win);

    wmove(win, 5, 9);
    ch = winch(win);

    wclear(win);
    wmove(win, 6, 2);
    waddstr(win, "The next char should be l:  ");
    winsch(win, ch);
    Continue(win);

#if HAVE_WINSSTR
    (void) mvwinsstr(win, 6, 2, "A1B2C3D4E5");
    Continue(win);
#endif

    wmove(win, 5, 1);
    winsertln(win);
    MvWAddStr(win, 5, 2, "The lines below should have moved down");
    Continue(win);

    wclear(win);
    wmove(win, 2, 2);
    wprintw(win, "This is a formatted string in a window: %d %s\n", 42,
	    "is it");
    MvWAddStr(win, 10, 1, "Enter a string: ");
    wrefresh(win);
    noraw();
    echo();
    *Buffer = 0;
    wscanw(win, "%s", Buffer);

    printw("This is a formatted string in stdscr: %d %s\n", 42, "is it");
    MvAddStr(10, 1, "Enter a string: ");
    *Buffer = 0;
    scanw("%s", Buffer);

    if (TIGETSTR("cvvis", "vs") != 0) {
	wclear(win);
	curs_set(2);
	MvWAddStr(win, 1, 1, "The cursor should appear as a block (visible)");
	Continue(win);
    }

    if (TIGETSTR("civis", "vi") != 0) {
	wclear(win);
	curs_set(0);
	MvWAddStr(win, 1, 1,
		  "The cursor should have disappeared (invisible)");
	Continue(win);
    }

    if (TIGETSTR("cnorm", "ve") != 0) {
	wclear(win);
	curs_set(1);
	MvWAddStr(win, 1, 1, "The cursor should be an underline (normal)");
	Continue(win);
    }
#ifdef A_COLOR
    if (has_colors()) {
	wclear(win);
	MvWAddStr(win, 1, 1, "Colors should change after you press a key");
	Continue(win);
	init_pair(1, COLOR_RED, COLOR_WHITE);
	wrefresh(win);
    }
#endif

    werase(win);

#if HAVE_TERMNAME
    MvWAddStr(win, 1, 1, "Information About Your Terminal");
    MvWAddStr(win, 3, 1, termname());
    MvWAddStr(win, 4, 1, longname());
    if (termattrs() & A_BLINK)
	MvWAddStr(win, 5, 1, "This terminal supports blinking.");
    else
	MvWAddStr(win, 5, 1, "This terminal does NOT support blinking.");
#endif

    (void) mvwaddnstr(win, 7, 5, "Have a nice day!ok", 16);
    wrefresh(win);

    (void) mvwinnstr(win, 7, 5, Buffer, 18);
    MvAddStr(LINES - 2, 10, Buffer);
    refresh();
    Continue(win);
}
示例#9
0
static void
inputTest(WINDOW *win)
{
    int answered;
    int repeat;
    int w, h, bx, by, sw, sh, i, c, num;
    char buffer[80];
    WINDOW *subWin;
    wclear(win);

    getmaxyx(win, h, w);
    getbegyx(win, by, bx);
    sw = w / 3;
    sh = h / 3;
    if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL)
	return;

#ifdef A_COLOR
    if (has_colors()) {
	init_pair(2, COLOR_WHITE, COLOR_RED);
	wbkgd(subWin, (chtype) COLOR_PAIR(2) | A_BOLD);
    } else
	wbkgd(subWin, A_BOLD);
#else
    wbkgd(subWin, A_BOLD);
#endif
    box(subWin, ACS_VLINE, ACS_HLINE);
    wrefresh(win);

    nocbreak();
    MvWAddStr(win, 2, 1, "Press some keys for 5 seconds");
    MvWAddStr(win, 1, 1, "Pressing ^C should do nothing");
    wrefresh(win);

    werase(subWin);
    box(subWin, ACS_VLINE, ACS_HLINE);
    for (i = 0; i < 5; i++) {
	MvWPrintw(subWin, 1, 1, "Time = %d", i);
	wrefresh(subWin);
	napms(1000);
	flushinp();
    }

    delwin(subWin);
    werase(win);
    flash();
    wrefresh(win);
    napms(500);

    MvWAddStr(win, 2, 1, "Press a key, followed by ENTER");
    wmove(win, 9, 10);
    wrefresh(win);
    echo();
    noraw();
    wgetch(win);
    flushinp();

    wmove(win, 9, 10);
    wdelch(win);
    MvWAddStr(win, 4, 1, "The character should now have been deleted");
    Continue(win);

    wclear(win);
    MvWAddStr(win, 1, 1, "Press keys (or mouse buttons) to show their names");
    MvWAddStr(win, 2, 1, "Press spacebar to finish");
    wrefresh(win);

    keypad(win, TRUE);
    raw();
    noecho();

#if HAVE_TYPEAHEAD
    typeahead(-1);
#endif

#ifdef NCURSES_MOUSE_VERSION
    mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0);
#endif
#if defined(PDCURSES)
    mouse_set(ALL_MOUSE_EVENTS);
#endif

    for (;;) {
	wmove(win, 3, 5);
	c = wgetch(win);
	wclrtobot(win);
	if (c >= KEY_MIN)
	    wprintw(win, "Key Pressed: %s", keyname(c));
	else if (isprint(c))
	    wprintw(win, "Key Pressed: %c", c);
	else
	    wprintw(win, "Key Pressed: %s", unctrl(UChar(c)));
#ifdef KEY_MOUSE
	if (c == KEY_MOUSE) {
#if defined(NCURSES_MOUSE_VERSION)
#define ButtonChanged(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, 037))
#define ButtonPressed(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED))
#define ButtonDouble(n)  ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED))
#define ButtonTriple(n)  ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED))
#define ButtonRelease(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED))
	    MEVENT event;
	    int button = 0;

	    getmouse(&event);
	    if (ButtonChanged(1))
		button = 1;
	    else if (ButtonChanged(2))
		button = 2;
	    else if (ButtonChanged(3))
		button = 3;
	    else
		button = 0;
	    wmove(win, 4, 18);
	    wprintw(win, "Button %d: ", button);
	    if (ButtonPressed(button))
		wprintw(win, "pressed: ");
	    else if (ButtonDouble(button))
		wprintw(win, "double: ");
	    else if (ButtonTriple(button))
		wprintw(win, "triple: ");
	    else
		wprintw(win, "released: ");
	    wprintw(win, " Position: Y: %d X: %d", event.y, event.x);
#elif defined(PDCURSES)
	    int button = 0;
	    request_mouse_pos();
	    if (BUTTON_CHANGED(1))
		button = 1;
	    else if (BUTTON_CHANGED(2))
		button = 2;
	    else if (BUTTON_CHANGED(3))
		button = 3;
	    else
		button = 0;
	    wmove(win, 4, 18);
	    wprintw(win, "Button %d: ", button);
	    if (MOUSE_MOVED)
		wprintw(win, "moved: ");
	    else if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_PRESSED)
		wprintw(win, "pressed: ");
	    else if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED)
		wprintw(win, "double: ");
	    else
		wprintw(win, "released: ");
	    wprintw(win, " Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS);
#endif /* NCURSES_VERSION vs PDCURSES */
	}
#endif /* KEY_MOUSE */
	wrefresh(win);
	if (c == ' ')
	    break;
    }
#if 0
    nodelay(win, TRUE);
    wgetch(win);
    nodelay(win, FALSE);
#endif
#if defined(PDCURSES)
    mouse_set(0L);
#endif
    refresh();

    repeat = 0;
    do {
	static const char *fmt[] =
	{
	    "%d %10s",
	    "%d %[a-zA-Z]s",
	    "%d %[][a-zA-Z]s",
	    "%d %[^0-9]"
	};
	char *format = strdup(fmt[(unsigned) repeat % SIZEOF(fmt)]);

	wclear(win);
	MvWAddStr(win, 3, 2, "The window should have moved");
	MvWAddStr(win, 4, 2,
		  "This text should have appeared without you pressing a key");
	MvWPrintw(win, 6, 2,
		  "Scanning with format \"%s\"", format);
	mvwin(win, 2 + 2 * (repeat % 4), 1 + 2 * (repeat % 4));
	erase();
	refresh();
	wrefresh(win);
	echo();
	noraw();
	num = 0;
	*buffer = 0;
	answered = mvwscanw(win, 7, 6, format, &num, buffer);
	MvWPrintw(win, 8, 6,
		  "String: %s Number: %d (%d values read)",
		  buffer, num, answered);
	Continue(win);
	++repeat;
	free(format);
    } while (answered > 0);
}