104 fputs(
"\033[?1049h", stdout);
106 keypad(stdscr,
true);
107 clearok(stdscr,
true);
175 struct termios term = { 0 };
176 struct termios old = { 0 };
178 int fd = open(
"/dev/tty", O_RDONLY);
185 term.c_lflag &= ~(ICANON | ECHO);
187 term.c_cc[VTIME] = 255;
188 tcsetattr(fd, TCSANOW, &term);
193 fputs(
_(
"Press any key to continue..."), stdout);
198 while (read(fd, &ch, 1) == 0)
203 term.c_cc[VTIME] = 0;
204 tcsetattr(fd, TCSANOW, &term);
206 char buf[64] = { 0 };
207 while (read(fd, buf,
sizeof(buf)) > 0)
210 tcsetattr(fd, TCSANOW, &old);
213 fputs(
"\r\n", stdout);
215 return (ch >= 0) ? ch : EOF;
237 struct Mailbox *m,
bool multiple,
char ***files,
258 struct KeyEvent event = { 0, OP_NULL };
289 if (event.
op == OP_NULL)
320 char buf[MB_LEN_MAX * 2];
321 mbstate_t mbstate = { 0 };
346 mbstate_t mbstate = { 0 };
348 for (; len && (k = mbrtowc(&wc, s, len, &mbstate)); s += k, len -= k)
353 memset(&mbstate, 0,
sizeof(mbstate));
359 const int w = wcwidth(wc);
386 size_t n, w = 0, l = 0, cl;
388 mbstate_t mbstate = { 0 };
395 for (w = 0; n && (cl = mbrtowc(&wc, src, n, &mbstate)); src += cl, n -= cl)
399 memset(&mbstate, 0,
sizeof(mbstate));
417 else if ((cw < 0) && (cl == 1) && (src[0] !=
'\0') && (src[0] <
MUTT_TREE_MAX))
427 if (((cl + l) > maxlen) || ((cw + w) > maxwid))
464 mbstate_t mbstate = { 0 };
466 for (w = 0; n && (k = mbrtowc(&wc, s, n, &mbstate)); s += k, n -= k)
478 memset(&mbstate, 0,
sizeof(mbstate));
505 char prompt[256] = { 0 };
513 char keys[256] = { 0 };
526 if (ch == KEY_RESIZE)
529 while ((ch = getch()) == KEY_RESIZE)
555 snprintf(keys,
sizeof(keys),
_(
"Char = %s, Octal = %o, Decimal = %d\n"),
#define ARRAY_EMPTY(head)
Check if an array is empty.
const struct CompleteOps CompleteMailboxOps
Auto-Completion of Files / Mailboxes.
Select a Mailbox from a list.
#define MUTT_SEL_MAILBOX
Select a mailbox.
#define MUTT_SEL_FOLDER
Select a local directory.
#define MUTT_SEL_MULTI
Multi-selection is enabled.
#define MUTT_SEL_NO_FLAGS
No flags are set.
uint8_t SelectFileFlags
Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Color and attribute parsing.
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_PROMPT
Question/user input.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
size_t mutt_strnwidth(const char *s, size_t n)
Measure a string's width in screen cells.
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_paddstr(struct MuttWindow *win, int n, const char *s)
Display a string on screen, padded if necessary.
void mutt_refresh(void)
Force a refresh of the screen.
int mutt_addwch(struct MuttWindow *win, wchar_t wc)
Addwch would be provided by an up-to-date curses library.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
void mutt_need_hard_redraw(void)
Force a hard refresh.
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
void mutt_endwin(void)
Shutdown curses.
void mutt_beep(bool force)
Irritate the user.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
GUI miscellaneous curses (window drawing) routines.
void mutt_flushinp(void)
Empty all the keyboard buffers.
struct KeyEvent mutt_getch(GetChFlags flags)
Read a character from the input buffer.
void mutt_unget_op(int op)
Return an operation to the input buffer.
void mutt_unget_ch(int ch)
Return a keystroke to the input buffer.
void buf_file_expand_fmt_quote(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
struct KeyEventArray MacroEvents
These are used for macros and exec/push commands.
bool OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program
bool OptNoCurses
(pseudo) when sending in batch mode
bool OptForceRefresh
(pseudo) refresh even during macros
void dlg_browser(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file -.
void mw_what_key(void)
Display the value of a key -.
int mw_enter_fname(const char *prompt, struct Buffer *fname, bool mailbox, struct Mailbox *m, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
Read/write command history from/to a file.
HistoryClass
Type to differentiate different histories.
const char * km_keyname(int c)
Get the human name for a key.
keycode_t AbortKey
code of key to abort prompts, normally Ctrl-G
#define GETCH_NO_FLAGS
No flags are set.
void mutt_exit(int code)
Leave NeoMutt NOW.
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_set_text(struct MuttWindow *win, const char *text, enum ColorId color)
Set the text for the Message Window.
wchar_t ReplacementChar
When a Unicode character can't be displayed, use this instead.
#define ICONV_BUF_TOO_SMALL
Error value for iconv() - Buffer too small.
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
Convenience wrapper for the library headers.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
int mutt_str_asprintf(char **strp, const char *fmt,...)
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Many unsorted constants and some structs.
#define MUTT_COMP_CLEAR
Clear input if printable character is pressed.
Define wrapper functions around Curses.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Create/manipulate threading in emails.
@ MUTT_SPECIAL_INDEX
Colour indicator.
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.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
@ NT_TIMEOUT
Timeout has occurred.
@ NT_RESIZE
Window has been resized.
All user-callable functions.
#define OP_TIMEOUT
1 second with no events
#define OP_REPAINT
Repaint is needed.
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.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
volatile sig_atomic_t SigWinch
true after SIGWINCH is received
volatile sig_atomic_t SigInt
true after SIGINT is received
A curses colour and its attributes.
String manipulation buffer.
Input for the file completion function.
char *** files
List of files selected.
struct Mailbox * mailbox
Mailbox.
bool multiple
Allow multiple selections.
int * numfiles
Number of files selected.
An event such as a keypress.
int op
Function opcode, e.g. OP_HELP.
Container for Accounts, Notifications.
struct Notify * notify_timeout
Timeout notifications handler.
struct Notify * notify_resize
Window resize notifications handler.
struct ConfigSubset * sub
Inherited config items.