43#ifdef HAVE_SYS_PARAM_H
81 while ((cur = strchr(prompt,
'(')))
86 if (isalnum(cur[1]) && (cur[2] ==
')'))
110 struct KeyEvent event = { 0, OP_NULL };
128 char *p = strchr(letters, event.
ch);
131 choice = p - letters + 1;
135 if ((event.
ch >
'0') && (event.
ch <=
'9'))
137 choice =
event.ch -
'0';
181 char *yes =
N_(
"yes");
183 char *trans_yes =
_(yes);
184 char *trans_no =
_(no);
186 regex_t reyes = { 0 };
187 regex_t reno = { 0 };
189 bool reyes_ok =
false;
190 bool reno_ok =
false;
196 char rexyes[16] =
"^[+1YyYy]";
197 rexyes[6] = toupper(trans_yes[0]);
198 rexyes[7] = tolower(trans_yes[0]);
200 char rexno[16] =
"^[-0NnNn]";
201 rexno[6] = toupper(trans_no[0]);
202 rexno[7] = tolower(trans_no[0]);
204 if (
REG_COMP(&reyes, rexyes, REG_NOSUB) == 0)
207 if (
REG_COMP(&reno, rexno, REG_NOSUB) == 0)
212 reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] ==
'^') &&
213 (
REG_COMP(&reyes, expr, REG_NOSUB) == 0);
214 reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] ==
'^') &&
215 (
REG_COMP(&reno, expr, REG_NOSUB) == 0);
218 if ((yes != trans_yes) && (no != trans_no) && reyes_ok && reno_ok)
239 bool show_help_prompt = cdef;
243 (def ==
MUTT_YES) ? no : yes, show_help_prompt ?
"/?" :
"");
249 struct KeyEvent event = { 0, OP_NULL };
270 char answer[4] = { 0 };
271 answer[0] =
event.ch;
272 if (reyes_ok ? (regexec(&reyes, answer, 0, 0, 0) == 0) : (tolower(event.
ch) ==
'y'))
277 if (reno_ok ? (regexec(&reno, answer, 0, 0, 0) == 0) : (tolower(event.
ch) ==
'n'))
282 if (show_help_prompt && (event.
ch ==
'?'))
284 show_help_prompt =
false;
288 char hyphen[128] = { 0 };
290 buf_add_printf(text,
"https://neomutt.org/guide/reference#%s\n", hyphen);
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, GetChFlags flags)
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.
uint8_t GetChFlags
Flags for mutt_getch(), e.g. GETCH_NO_FLAGS.
#define GETCH_IGNORE_MACRO
Don't use MacroEvents.
#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_ignore_macro(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question ignoring the macro buffer.
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)
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)