src/input.c

changeset 200
4913bc0ff3e5
parent 117
ee539a9691f0
child 202
6960625e62e0
equal deleted inserted replaced
199:3d4d361ebb80 200:4913bc0ff3e5
27 * 27 *
28 */ 28 */
29 29
30 #include "input.h" 30 #include "input.h"
31 #include <ctype.h> 31 #include <ctype.h>
32 #include <stdbool.h> /* necessary to avoid errors with outdated curses.h */
33 #include <curses.h>
32 34
33 int prompt_yesno(char *msg) { 35 int prompt_yesno(char *msg) {
34 printw("%s (y/n)? ", msg); 36 printw("%s (y/n)? ", msg);
35 clrtoeol(); 37 clrtoeol();
36 refresh(); 38 refresh();
42 echo(); 44 echo();
43 45
44 return ch == 'y'; 46 return ch == 'y';
45 } 47 }
46 48
47 int mvwasyncgetnstr(WINDOW* w,int y,int x,char *str,size_t *pos,size_t len) { 49 int asyncgetnstr(char *str, size_t *pos, size_t len) {
50 WINDOW* w = stdscr;
51 int y, x;
52 getyx(w, y, x);
48 mvwaddnstr(w, y, x, str, *pos); 53 mvwaddnstr(w, y, x, str, *pos);
49 wrefresh(w); 54 wrefresh(w);
50 int c = wgetch(w); 55 int c = wgetch(w);
51 56
52 if (c != ERR) { 57 if (c != ERR) {

mercurial