X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Ftest_getstr.c;h=0910a041e42b53eb50ad0fd12b3d0ea041851658;hp=4c243092b75460ec9c2d63ba4e12d060548752c8;hb=f3ec084eb66ba14feb6357b674fb85dd474933d8;hpb=5e1e572b71ae31a6071daa24e2460a68a6f1003c diff --git a/test/test_getstr.c b/test/test_getstr.c index 4c243092..0910a041 100644 --- a/test/test_getstr.c +++ b/test/test_getstr.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2007-2012,2017 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 2007-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,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_getstr.c,v 1.11 2017/04/15 14:14:37 tom Exp $ + * $Id: test_getstr.c,v 1.14 2020/02/02 23:34:34 tom Exp $ * * Author: Thomas E Dickey * @@ -43,6 +44,7 @@ */ #include +#include #if HAVE_CHGAT /* Solaris SVr4 curses lacks wchgat, mvgetnstr, mvwgetnstr */ @@ -86,14 +88,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); } @@ -143,6 +145,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, - move beginning of prompt one up row", + " j, - move beginning of prompt one down row", + " h, - move beginning of prompt one left column", + " l, - 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", + " ?, - show help-screen", + 0 + }; WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; @@ -322,6 +346,9 @@ recursive_test(int level, char **argv, WINDOW *strwin) wprintw(strwin, "%s:%s", ok_keyname(rc), buffer); wnoutrefresh(strwin); break; + case HELP_KEY_1: + popup_msg(stdscr, help); + break; default: beep(); break;