85 while ((cur = strchr(prompt,
'(')))
90 if (isalnum(cur[1]) && (cur[2] ==
')'))
114 struct KeyEvent event = { 0, OP_NULL };
132 char *p = strchr(letters, event.
ch);
135 choice = p - letters + 1;
139 if ((event.
ch >
'0') && (event.
ch <=
'9'))
141 choice =
event.ch -
'0';
184 char *yes =
N_(
"yes");
186 char *trans_yes =
_(yes);
187 char *trans_no =
_(no);
189 regex_t reyes = { 0 };
190 regex_t reno = { 0 };
192 bool reyes_ok =
false;
193 bool reno_ok =
false;
199 char rexyes[16] =
"^[+1YyYy]";
200 rexyes[6] = toupper(trans_yes[0]);
201 rexyes[7] = tolower(trans_yes[0]);
203 char rexno[16] =
"^[-0NnNn]";
204 rexno[6] = toupper(trans_no[0]);
205 rexno[7] = tolower(trans_no[0]);
207 if (
REG_COMP(&reyes, rexyes, REG_NOSUB) == 0)
210 if (
REG_COMP(&reno, rexno, REG_NOSUB) == 0)
215 reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] ==
'^') &&
216 (
REG_COMP(&reyes, expr, REG_NOSUB) == 0);
217 reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] ==
'^') &&
218 (
REG_COMP(&reno, expr, REG_NOSUB) == 0);
221 if ((yes != trans_yes) && (no != trans_no) && reyes_ok && reno_ok)
242 bool show_help_prompt = cdef;
246 (def ==
MUTT_YES) ? no : yes, show_help_prompt ?
"/?" :
"");
252 struct KeyEvent event = { 0, OP_NULL };
273 char answer[4] = { 0 };
274 answer[0] =
event.ch;
275 if (reyes_ok ? (regexec(&reyes, answer, 0, 0, 0) == 0) : (tolower(event.
ch) ==
'y'))
280 if (reno_ok ? (regexec(&reno, answer, 0, 0, 0) == 0) : (tolower(event.
ch) ==
'n'))
285 if (show_help_prompt && (event.
ch ==
'?'))
287 show_help_prompt =
false;
291 char hyphen[128] = { 0 };
293 buf_add_printf(text,
"https://neomutt.org/guide/reference#%s\n", hyphen);
353 assert(value != INT_MIN);
376 assert(value != INT_MIN);
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "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 HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
void mutt_refresh(void)
Force a refresh of the screen.
void mutt_beep(bool force)
Irritate the user.
struct KeyEvent mutt_getch(GetChFlags flags)
Read a character from the input buffer.
static enum QuadOption mw_yesorno(const char *prompt, enum QuadOption def, struct ConfigDef *cdef)
Ask the user a Yes/No question offering help -.
int mw_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question -.
#define mutt_debug(LEVEL,...)
Convenience wrapper for the gui headers.
#define GETCH_NO_FLAGS
No flags are set.
@ LL_DEBUG1
Log at debug level 1.
const struct AttrColor * merged_color_overlay(const struct AttrColor *base, const struct AttrColor *over)
Combine two colours.
void msgcont_push_window(struct MuttWindow *win)
Add a window to the Container Stack.
struct MuttWindow * msgcont_pop_window(void)
Remove the last Window from the Container Stack.
struct MuttWindow * msgwin_new(bool interactive)
Create the Message Window.
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
void msgwin_add_text(struct MuttWindow *win, const char *text, const struct AttrColor *ac_color)
Add text to the Message Window.
void msgwin_add_text_n(struct MuttWindow *win, const char *text, int bytes, const struct AttrColor *ac_color)
Add some text to the Message Window.
void msgwin_set_text(struct MuttWindow *win, const char *text, enum ColorId color)
Set the text for the Message Window.
Convenience wrapper for the library headers.
void mutt_str_hyphenate(char *buf, size_t buflen, const char *str)
Hyphenate a snake-case string.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
#define key_is_return(ch)
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
#define OP_TIMEOUT
1 second with no events
#define OP_REPAINT
Repaint is needed.
#define OP_ABORT
$abort_key pressed (Ctrl-G)
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
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 query_yesorno_help(const char *prompt, enum QuadOption def, struct ConfigSubset *sub, const char *name)
Ask the user a Yes/No question offering help.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
A curses colour and its attributes.
String manipulation buffer.
const char * name
User-visible name.
const char * docs
One-liner description.
A set of inherited config items.
The item stored in a Hash Table.
int type
Type of data stored in Hash Table, e.g. DT_STRING.
void * data
User-supplied data.
An event such as a keypress.
int op
Function opcode, e.g. OP_HELP.
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
#define DTYPE(x)
Mask for the Data Type.
#define DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
#define DT_BOOL
boolean option