X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-ui%2Fcurs_lib.c;fp=lib-ui%2Fcurs_lib.c;h=3c0f440a675a8b1b1d154740031c4c7d22fc5379;hb=6fb2acab15d7fd84a287cc50ef472d34018636bd;hp=53609b5b9c3184ad0c7b6dd95ce7c0fd8afce792;hpb=df46bef7e086274216fb9072286626ae14ef2617;p=apps%2Fmadmutt.git diff --git a/lib-ui/curs_lib.c b/lib-ui/curs_lib.c index 53609b5..3c0f440 100644 --- a/lib-ui/curs_lib.c +++ b/lib-ui/curs_lib.c @@ -317,6 +317,24 @@ void mutt_show_error (void) SETCOLOR (MT_COLOR_NORMAL); } +void curses_initialize(void) +{ + ci_start_color(); + keypad(stdscr, TRUE); + cbreak(); + noecho(); + typeahead (-1); /* simulate smooth scrolling */ + meta(stdscr, TRUE); +} + +void curses_install(void) +{ + SETCOLOR(MT_COLOR_NORMAL); + wclear(stdscr); + mutt_error = mutt_curses_error; + mutt_message = mutt_curses_message; +} + void mutt_endwin (const char *msg) { if (!option (OPTNOCURSES)) { @@ -339,6 +357,27 @@ void _mutt_perror (const char *s, const char* filename, int line) mutt_error ("%s: %s (errno = %d) from %s:%i", s, p ? p : _("unknown error"), errno, filename, line); } +/* + * prompts the user to enter a keystroke, and displays the octal value back + * to the user. + */ +void mutt_what_key (void) +{ + int ch; + + mvwprintw (stdscr, LINES - 1, 0, _("Enter keys (^G to abort): ")); + do { + ch = wgetch (stdscr); + if (ch != ERR && ch != ctrl ('G')) { + mutt_message (_("Char = %s, Octal = %o, Decimal = %d"), + km_keyname (ch), ch, ch); + } + } + while (ch != ERR && ch != ctrl ('G')); + + mutt_flushinp (); +} + int mutt_any_key_to_continue (const char *s) { struct termios t;