X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fview.c;h=da073151e3fb98d0225938f4bc4426ac203e1f04;hp=5d94cda05751a7a841c66f9700fa465215cea2d6;hb=2560bc3dae7f4919060c02c91a593566c908091c;hpb=e2e9c09c48b19b24979cafb2d4864f538b5ddd1c diff --git a/test/view.c b/test/view.c index 5d94cda0..da073151 100644 --- a/test/view.c +++ b/test/view.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,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 * @@ -50,11 +50,12 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.97 2016/09/10 21:05:46 tom Exp $ + * $Id: view.c,v 1.101 2017/04/15 20:14:01 tom Exp $ */ #include #include +#include #include @@ -227,6 +228,28 @@ ch_dup(char *src) int main(int argc, char *argv[]) { + static const char *help[] = + { + "Commands:", + " q,^Q,ESC - quit this program", + "", + " p, - scroll the viewport up by one row", + " n, - scroll the viewport down by one row", + " l, - scroll the viewport left by one column", + " r, - scroll the viewport right by one column", + "", + " h, - scroll the viewport to top of file", + " e, - scroll the viewport to end of file", + "", + " ^L - repaint using redrawwin()", + "", + " 0 through 9 - enter digits for count", + " s - use entered count for halfdelay() parameter", + " - if no entered count, stop nodelay()", + " - begin nodelay()", + 0 + }; + int MAXLINES = 1000; FILE *fp; char buf[BUFSIZ]; @@ -473,6 +496,8 @@ main(int argc, char *argv[]) break; case 'q': + case QUIT: + case ESCAPE: done = TRUE; break; @@ -499,6 +524,9 @@ main(int argc, char *argv[]) if (!my_delay) napms(50); break; + case HELP_KEY_1: + popup_msg(stdscr, help); + break; default: beep(); break; @@ -571,7 +599,7 @@ show_all(const char *tag) "%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift); i = (int) strlen(temp); if ((i + 7) < (int) sizeof(temp)) { - _nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - i) + _nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - (size_t) i) "view %.*s", (int) (sizeof(temp) - 7 - (size_t) i), fname);