📄 demo_keyok.c
字号:
/* * $Id: demo_keyok.c,v 1.3 2003/05/17 23:18:34 tom Exp $ * * Demonstrate the keyok() function. * Thomas Dickey - 2002/11/23 */#include <test.priv.h>#if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCSintmain(int argc GCC_UNUSED, char *argv[]GCC_UNUSED){ int lastch = ERR; int ch; WINDOW *win; initscr(); (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ printw("Typing any function key will disable it, but typing it twice in\n"); printw("a row will turn it back on (just for a demo)."); refresh(); win = newwin(LINES - 2, COLS, 2, 0); scrollok(win, TRUE); keypad(win, TRUE); wmove(win, 0, 0); while ((ch = wgetch(win)) != ERR) { const char *name = keyname(ch); wprintw(win, "Keycode %d, name %s\n", ch, name != 0 ? name : "<null>"); wclrtoeol(win); wrefresh(win); if (ch >= KEY_MIN) { keyok(ch, FALSE); lastch = ch; } else if (lastch >= KEY_MIN) { keyok(lastch, TRUE); } } endwin(); return EXIT_SUCCESS;}#elseintmain(void){ printf("This program requires the ncurses library\n"); ExitProgram(EXIT_FAILURE);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -