This changes some of the "prompting" routines to use the MuttMessageWindow.
-- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch # User Kevin McCarthy <ke...@8t8.us> # Date 1461088983 25200 # Tue Apr 19 11:03:03 2016 -0700 # Node ID e79f81c7461d1e90dea3f8ef2a693ecead6a58bb # Parent 0fd22c9aaf4f29545dcdcce1e353c319c883ec46 Modify the curs_lib.c to use windows. This changes some of the "prompting" routines to use the MuttMessageWindow. diff --git a/curs_lib.c b/curs_lib.c --- a/curs_lib.c +++ b/curs_lib.c @@ -152,26 +152,26 @@ { int ret; int x, y; ENTER_STATE *es = mutt_new_enter_state(); do { - CLEARLINE (LINES-1); + mutt_window_clearline (MuttMessageWindow, 0); SETCOLOR (MT_COLOR_PROMPT); addstr ((char *)field); /* cast to get around bad prototypes */ NORMAL_COLOR; mutt_refresh (); getyx (stdscr, y, x); ret = _mutt_enter_string (buf, buflen, y, x, complete, multiple, files, numfiles, es); } while (ret == 1); - CLEARLINE (LINES-1); + mutt_window_clearline (MuttMessageWindow, 0); mutt_free_enter_state (&es); return (ret); } int mutt_get_field_unbuffered (char *msg, char *buf, size_t buflen, int flags) { int rc; @@ -182,17 +182,17 @@ return (rc); } void mutt_clear_error (void) { Errorbuf[0] = 0; if (!option(OPTNOCURSES)) - CLEARLINE (LINES-1); + mutt_window_clearline (MuttMessageWindow, 0); } void mutt_edit_file (const char *editor, const char *data) { char cmd[LONG_STRING]; mutt_endwin (NULL); mutt_expand_file_fmt (cmd, sizeof (cmd), editor, data); @@ -229,28 +229,28 @@ answer[1] = 0; reyes_ok = (expr = nl_langinfo (YESEXPR)) && expr[0] == '^' && !REGCOMP (&reyes, expr, REG_NOSUB); reno_ok = (expr = nl_langinfo (NOEXPR)) && expr[0] == '^' && !REGCOMP (&reno, expr, REG_NOSUB); #endif - CLEARLINE(LINES-1); + mutt_window_clearline (MuttMessageWindow, 0); /* * In order to prevent the default answer to the question to wrapped * around the screen in the even the question is wider than the screen, * ensure there is enough room for the answer and truncate the question * to fit. */ safe_asprintf (&answer_string, " ([%s]/%s): ", def == M_YES ? yes : no, def == M_YES ? no : yes); answer_string_len = mutt_strwidth (answer_string); /* maxlen here is sort of arbitrary, so pick a reasonable upper bound */ - msglen = mutt_wstr_trunc (msg, 4*COLS, COLS - answer_string_len, NULL); + msglen = mutt_wstr_trunc (msg, 4*MuttMessageWindow->cols, MuttMessageWindow->cols - answer_string_len, NULL); SETCOLOR (MT_COLOR_PROMPT); addnstr (msg, msglen); addstr (answer_string); NORMAL_COLOR; FREE (&answer_string); FOREVER { @@ -333,26 +333,26 @@ static void curses_message (int error, const char *fmt, va_list ap) { char scratch[LONG_STRING]; vsnprintf (scratch, sizeof (scratch), fmt, ap); dprint (1, (debugfile, "%s\n", scratch)); mutt_format_string (Errorbuf, sizeof (Errorbuf), - 0, COLS, FMT_LEFT, 0, scratch, sizeof (scratch), 0); + 0, MuttMessageWindow->cols, FMT_LEFT, 0, scratch, sizeof (scratch), 0); if (!option (OPTKEEPQUIET)) { if (error) BEEP (); SETCOLOR (error ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); - mvaddstr (LINES-1, 0, Errorbuf); + mutt_window_mvaddstr (MuttMessageWindow, 0, 0, Errorbuf); NORMAL_COLOR; - clrtoeol (); + mutt_window_clrtoeol (MuttMessageWindow); mutt_refresh (); } if (error) set_option (OPTMSGERR); else unset_option (OPTMSGERR); } @@ -595,19 +595,19 @@ void mutt_show_error (void) { if (option (OPTKEEPQUIET)) return; SETCOLOR (option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); - mvaddstr(LINES-1, 0, Errorbuf); + mutt_window_mvaddstr (MuttMessageWindow, 0, 0, Errorbuf); NORMAL_COLOR; - clrtoeol(); + mutt_window_clrtoeol(MuttMessageWindow); } void mutt_endwin (const char *msg) { int e = errno; if (!option (OPTNOCURSES)) { @@ -692,28 +692,28 @@ return rc; } int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, int *redraw, int buffy, int multiple, char ***files, int *numfiles) { event_t ch; SETCOLOR (MT_COLOR_PROMPT); - mvaddstr (LINES-1, 0, (char *) prompt); + mutt_window_mvaddstr (MuttMessageWindow, 0, 0, (char *) prompt); addstr (_(" ('?' for list): ")); NORMAL_COLOR; if (buf[0]) addstr (buf); - clrtoeol (); + mutt_window_clrtoeol (MuttMessageWindow); mutt_refresh (); ch = mutt_getch(); if (ch.ch < 0) { - CLEARLINE (LINES-1); + mutt_window_clearline (MuttMessageWindow, 0); return (-1); } else if (ch.ch == '?') { mutt_refresh (); buf[0] = 0; _mutt_select_file (buf, blen, M_SEL_FOLDER | (multiple ? M_SEL_MULTI : 0), files, numfiles); @@ -816,19 +816,19 @@ int mutt_multi_choice (char *prompt, char *letters) { event_t ch; int choice; char *p; SETCOLOR (MT_COLOR_PROMPT); - mvaddstr (LINES - 1, 0, prompt); + mutt_window_mvaddstr (MuttMessageWindow, 0, 0, prompt); NORMAL_COLOR; - clrtoeol (); + mutt_window_clrtoeol (MuttMessageWindow); FOREVER { mutt_refresh (); ch = mutt_getch (); /* (ch.ch == 0) is technically possible. Treat the same as < 0 (abort) */ if (ch.ch <= 0 || CI_is_return (ch.ch)) { choice = -1; @@ -846,17 +846,17 @@ { choice = ch.ch - '0'; if (choice <= mutt_strlen (letters)) break; } } BEEP (); } - CLEARLINE (LINES - 1); + mutt_window_clearline (MuttMessageWindow, 0); mutt_refresh (); return choice; } /* * addwch would be provided by an up-to-date curses library */
signature.asc
Description: PGP signature