X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fredraw.c;h=b74c6e53739c9ec6d141c3794d9df89656ac8106;hp=9cb0de95a809a3e66845e559648668dacf8f51f7;hb=5e1e572b71ae31a6071daa24e2460a68a6f1003c;hpb=a924c24b2535cccdc0f5f991cd8ddcadcfa1f0d2 diff --git a/test/redraw.c b/test/redraw.c index 9cb0de95..b74c6e53 100644 --- a/test/redraw.c +++ b/test/redraw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,13 +26,14 @@ * authorization. * ****************************************************************************/ /* - * $Id: redraw.c,v 1.8 2012/12/08 20:46:02 tom Exp $ + * $Id: redraw.c,v 1.9 2017/04/15 19:57:47 tom Exp $ * * Demonstrate the redrawwin() and wredrawln() functions. * Thomas Dickey - 2006/11/4 */ #include +#include static void trash(int beg_x, int max_x, int cur_x) @@ -53,11 +54,30 @@ trash(int beg_x, int max_x, int cur_x) for (x = max_x; x > cur_x; --x) { putchar('\b'); } + fflush(stdout); } static void test_redraw(WINDOW *win) { + static const char *help[] = + { + "Commands:", + " ^Q/ESC/q - quit", + " w - recur in a new window", + " ! - overwrite current line using stdio outside curses.", +#ifdef NCURSES_VERSION + " @ - run \"date\" command, to put its output on screen.", +#endif + " ^L - call redrawwin() for current window.", + " ^W - call wredrawln() for current line/current window.", + " arrow-keys - move cursor on the screen", + "", + "Other control characters are added to the screen in printable form.", + "Other printable characters are added to the screen as is.", + 0 + }; + WINDOW *win1; WINDOW *win2; bool done = FALSE; @@ -77,6 +97,7 @@ test_redraw(WINDOW *win) switch (ch) { case 'q': /* FALLTHRU */ + case QUIT: case ESCAPE: done = TRUE; break; @@ -146,9 +167,14 @@ test_redraw(WINDOW *win) wmove(win, y, x + 1); break; + case HELP_KEY_1: + popup_msg(win, help); + break; + default: if (ch > KEY_MIN) { waddstr(win, keyname(ch)); + waddch(win, '\n'); } else { waddstr(win, unctrl(UChar(ch))); }