43#ifdef HAVE_SYS_PARAM_H
87 clearok(stdscr,
true);
99 prompt_lines =
MAX(1,
MIN(3, prompt_lines));
113 while ((cur = strchr(prompt,
'(')))
119 if (isalnum(cur[1]) && (cur[2] ==
')'))
155 char *p = strchr(letters, ch.
ch);
158 choice = p - letters + 1;
161 else if ((ch.
ch <=
'9') && (ch.
ch >
'0'))
163 choice = ch.
ch -
'0';
201 char *answer_string = NULL;
202 int answer_string_wid, msg_wid;
203 size_t trunc_msg_len;
205 int prompt_lines = 1;
206 char answer[2] = { 0 };
208 char *yes =
N_(
"yes");
210 char *trans_yes =
_(yes);
211 char *trans_no =
_(no);
213 regex_t reyes = { 0 };
214 regex_t reno = { 0 };
216 bool reyes_ok =
false;
217 bool reno_ok =
false;
223 char rexyes[16] =
"^[+1YyYy]";
224 rexyes[6] = toupper(trans_yes[0]);
225 rexyes[7] = tolower(trans_yes[0]);
227 char rexno[16] =
"^[-0NnNn]";
228 rexno[6] = toupper(trans_no[0]);
229 rexno[7] = tolower(trans_no[0]);
231 if (
REG_COMP(&reyes, rexyes, REG_NOSUB) == 0)
234 if (
REG_COMP(&reno, rexno, REG_NOSUB) == 0)
239 reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] ==
'^') &&
240 (
REG_COMP(&reyes, expr, REG_NOSUB) == 0);
241 reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] ==
'^') &&
242 (
REG_COMP(&reno, expr, REG_NOSUB) == 0);
245 if ((yes != trans_yes) && (no != trans_no) && reyes_ok && reno_ok)
288 clearok(stdscr,
true);
293 prompt_lines = (msg_wid + answer_string_wid + win->
state.
cols - 1) /
295 prompt_lines =
MAX(1,
MIN(3, prompt_lines));
305 (
size_t) 4 * prompt_lines * win->
state.
cols,
306 ((
size_t) prompt_lines * win->
state.
cols) - answer_string_wid,
331 if (reyes_ok ? (regexec(&reyes, answer, 0, 0, 0) == 0) : (tolower(ch.
ch) ==
'y'))
336 else if (reno_ok ? (regexec(&reno, answer, 0, 0, 0) == 0) : (tolower(ch.
ch) ==
'n'))
349 FREE(&answer_string);
Color and attribute parsing.
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
@ MT_COLOR_OPTIONS
Options in prompt.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_PROMPT
Question/user input.
Convenience wrapper for the config headers.
struct KeyEvent mutt_getch_timeout(int delay)
Get an event with a timeout.
size_t mutt_wstr_trunc(const char *src, size_t maxlen, size_t maxwid, size_t *width)
Work out how to truncate a widechar string.
void mutt_refresh(void)
Force a refresh of the screen.
void mutt_beep(bool force)
Irritate the user.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Convenience wrapper for the gui headers.
struct AttrColor * merged_color_overlay(struct AttrColor *base, struct AttrColor *over)
Combine two colours.
void msgwin_set_height(short height)
Resize the Message Window.
struct MuttWindow * msgwin_get_window(void)
Get the Message Window pointer.
void msgwin_clear_text(void)
Clear the text in the Message Window.
Convenience wrapper for the library headers.
int mutt_str_asprintf(char **strp, const char *fmt,...)
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
enum MuttCursorState mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
void mutt_curses_set_color(struct AttrColor *ac)
Set the colour and attributes for text.
struct AttrColor * mutt_curses_set_normal_backed_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
MuttCursorState
Cursor states for mutt_curses_set_cursor()
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
All user-callable functions.
QuadOption
Possible values for a quad-option.
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MUTT_ASKYES
Ask the user, defaulting to 'Yes'.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
A curses colour and its attributes.
An event such as a keypress.
int op
Function opcode, e.g. OP_HELP.
struct WindowState state
Current state of the Window.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.