Don't spin-loop in prompt().

This commit is contained in:
River Tarnell 2014-03-08 01:00:30 +00:00
parent f25e283f21
commit e8ccd681e3
3 changed files with 8 additions and 7 deletions

7
tts.c
View file

@ -320,7 +320,7 @@ struct kevent evs[2], rev;
} }
#endif #endif
while (input_char(&c) != ERR) { while (input_char(stdscr, &c) != ERR) {
#ifdef KEY_RESIZE #ifdef KEY_RESIZE
if (c == KEY_RESIZE) if (c == KEY_RESIZE)
continue; continue;
@ -737,7 +737,8 @@ input_macro(s)
} }
int int
input_char(c) input_char(win, c)
WINDOW *win;
wchar_t *c; wchar_t *c;
{ {
if (macro_pos) { if (macro_pos) {
@ -749,5 +750,5 @@ input_char(c)
macro_text = macro_pos = NULL; macro_text = macro_pos = NULL;
} }
return get_wch(c); return wget_wch(win, c);
} }

4
ui.c
View file

@ -177,7 +177,7 @@ wint_t c;
waddwstr(pwin, L" [y/N]? "); waddwstr(pwin, L" [y/N]? ");
wattroff(pwin, A_BOLD); wattroff(pwin, A_BOLD);
while (input_char(&c) == ERR while (input_char(pwin, &c) == ERR
#ifdef KEY_RESIZE #ifdef KEY_RESIZE
|| (c == KEY_RESIZE) || (c == KEY_RESIZE)
#endif #endif
@ -231,7 +231,7 @@ histent_t *histpos = NULL;
wmove(pwin, 0, wcslen(msg) + 1 + pos); wmove(pwin, 0, wcslen(msg) + 1 + pos);
wrefresh(pwin); wrefresh(pwin);
if (input_char(&c) == ERR) if (input_char(pwin, &c) == ERR)
continue; continue;
switch (c) { switch (c) {

2
wide.h
View file

@ -18,7 +18,7 @@
#define wsizeof(s) (sizeof(s) / sizeof(wchar_t)) #define wsizeof(s) (sizeof(s) / sizeof(wchar_t))
int input_char(wchar_t *); int input_char (WINDOW *, wchar_t *);
void input_macro (wchar_t *); void input_macro (wchar_t *);
#endif /* !TTS_WIDE_H */ #endif /* !TTS_WIDE_H */