]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/test_get_wstr.c
ncurses 6.1 - patch 20191123
[ncurses.git] / test / test_get_wstr.c
index a3037b1bf61d331136d48ef972019c9675ce0579..f07c2e05d1ef1faecfdb1cc389fcf9351bfa243f 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_get_wstr.c,v 1.9 2017/04/15 14:14:25 tom Exp $
+ * $Id: test_get_wstr.c,v 1.11 2017/09/28 23:10:54 tom Exp $
  *
  * Author: Thomas E Dickey
  *
@@ -43,6 +43,7 @@
  */
 
 #include <test.priv.h>
+#include <popup_msg.h>
 
 #if HAVE_CHGAT
 /* NetBSD curses wchgat */
@@ -79,14 +80,14 @@ Remainder(WINDOW *txtwin)
 static void
 ShowPrompt(WINDOW *txtwin, int limit)
 {
-    wchgat(txtwin, limit, A_REVERSE, 0, NULL);
+    wchgat(txtwin, limit, WA_REVERSE, 0, NULL);
     wnoutrefresh(txtwin);
 }
 
 static void
 MovePrompt(WINDOW *txtwin, int limit, int y, int x)
 {
-    wchgat(txtwin, Remainder(txtwin), A_NORMAL, 0, NULL);
+    wchgat(txtwin, Remainder(txtwin), WA_NORMAL, 0, NULL);
     wmove(txtwin, y, x);
     ShowPrompt(txtwin, limit);
 }
@@ -136,6 +137,28 @@ ShowFlavor(WINDOW *strwin, WINDOW *txtwin, int flavor, int limit)
 static int
 recursive_test(int level, char **argv, WINDOW *strwin)
 {
+    static const char *help[] =
+    {
+       "Commands:",
+       "  q,^Q,ESC       - quit this program",
+       "  ^Q,ESC         - quit help-screen",
+       "",
+       "  p,<Up>         - move beginning of prompt one up row",
+       "  j,<Down>       - move beginning of prompt one down row",
+       "  h,<Left>       - move beginning of prompt one left column",
+       "  l,<Right>      - move beginning of prompt one right column",
+       "",
+       "  -              - reduce getnstr buffer-size one column",
+       "  +              - increase getnstr buffer-size one column",
+       "  :              - prompt for input-text",
+       "",
+       "  <              - scroll \"left\" through getstr-functions",
+       "  >              - scroll \"right\" through getstr-functions",
+       "",
+       "  w              - recur to subwindow",
+       "  ?,<F1>         - show help-screen",
+       0
+    };
     WINDOW *txtbox = 0;
     WINDOW *txtwin = 0;
     FILE *fp;
@@ -311,10 +334,13 @@ recursive_test(int level, char **argv, WINDOW *strwin)
            }
            noecho();
            (void) wattrset(txtwin, A_NORMAL);
-           wprintw(strwin, "%d", rc);
+           wprintw(strwin, "%s:", (rc == OK) ? "OK" : "ERR");
            (void) waddwstr(strwin, (wchar_t *) buffer);
            wnoutrefresh(strwin);
            break;
+       case HELP_KEY_1:
+           popup_msg(stdscr, help);
+           break;
        default:
            beep();
            break;