From: Pierre Habouzit Date: Thu, 8 Nov 2007 13:03:10 +0000 (+0100) Subject: Use mutt_multi_choice in flags.c X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=ad6431fce168427ae055362ea859725336c973e7;p=apps%2Fmadmutt.git Use mutt_multi_choice in flags.c This marks the end of the use of stdscr outside from lib-ui \o/ Signed-off-by: Pierre Habouzit --- diff --git a/flags.c b/flags.c index 7aa65d4..a893cc7 100644 --- a/flags.c +++ b/flags.c @@ -320,6 +320,8 @@ int mutt_thread_set_flag (HEADER * hdr, int flag, int bf, int subthread) int mutt_change_flag(HEADER * h, int bf) { + char buf[STRING]; + const char letters[] = "dDnNoOrR*!"; static char const actions[] = { ['d'] = M_DELETE, ['D'] = M_DELETE, ['n'] = M_NEW, ['N'] = M_NEW, @@ -331,20 +333,12 @@ int mutt_change_flag(HEADER * h, int bf) int c; - mvwprintw(stdscr, LINES - 1, 0, "%s? (D/N/O/r/*/!): ", + snprintf(buf, sizeof(buf), "%s? (D/N/O/r/*/!): ", bf ? _("Set flag") : _("Clear flag")); - wclrtoeol(stdscr); - c = mutt_getch().ch; - CLEARLINE(stdscr, LINES - 1); - if (c == -1) { - return (-1); - } - - if (c < 0 || c > countof(actions) || !actions[c]) { - BEEP(); + c = mutt_multi_choice(buf, letters); + if (c <= 0) return -1; - } - + c = letters[c - 1]; if (actions[c] == M_OLD) { if (h) { mutt_set_flag(Context, h, M_READ, !bf);