Go to the documentation of this file.
66 #define COMB_CHAR(wc) (IsWPrint(wc) && !wcwidth(wc))
96 wchar_t *savebuf = NULL;
101 memcpy(savebuf, state->
wbuf + state->
curpos, savelen *
sizeof(
wchar_t));
117 memcpy(state->
wbuf + state->
curpos, savebuf, savelen *
sizeof(
wchar_t));
157 clearok(stdscr,
true);
181 bool multiple,
struct Mailbox *m,
char ***files,
189 wchar_t *tempbuf = NULL;
194 memset(&mbstate, 0,
sizeof(mbstate));
264 rc = (
SigWinch && (ch == -2)) ? 1 : -1;
271 if ((ch != OP_EDITOR_COMPLETE) && (ch != OP_EDITOR_COMPLETE_QUERY))
276 case OP_EDITOR_HISTORY_UP:
287 case OP_EDITOR_HISTORY_DOWN:
298 case OP_EDITOR_HISTORY_SEARCH:
307 case OP_EDITOR_BACKSPACE:
338 case OP_EDITOR_KILL_LINE:
343 case OP_EDITOR_KILL_EOL:
347 case OP_EDITOR_BACKWARD_CHAR:
359 case OP_EDITOR_FORWARD_CHAR:
373 case OP_EDITOR_BACKWARD_WORD:
385 case OP_EDITOR_FORWARD_WORD:
403 case OP_EDITOR_CAPITALIZE_WORD:
404 case OP_EDITOR_UPCASE_WORD:
405 case OP_EDITOR_DOWNCASE_WORD:
418 if (ch == OP_EDITOR_DOWNCASE_WORD)
423 if (ch == OP_EDITOR_CAPITALIZE_WORD)
424 ch = OP_EDITOR_DOWNCASE_WORD;
430 case OP_EDITOR_DELETE_CHAR:
443 (state->
lastchar - i) *
sizeof(
wchar_t));
448 case OP_EDITOR_KILL_WORD:
453 while (i && iswspace(state->
wbuf[i - 1]))
457 if (iswalnum(state->
wbuf[i - 1]))
459 for (--i; (i > 0) && iswalnum(state->
wbuf[i - 1]); i--)
472 case OP_EDITOR_KILL_EOW:
485 if (iswalnum(state->
wbuf[i]))
488 for (; (i < state->
lastchar) && iswalnum(state->
wbuf[i]); i++)
499 (state->
lastchar - i) *
sizeof(
wchar_t));
504 case OP_EDITOR_MAILBOX_CYCLE:
526 case OP_EDITOR_COMPLETE:
527 case OP_EDITOR_COMPLETE_QUERY:
537 if (tempbuf && (templen == (state->
lastchar - i)) &&
538 (memcmp(tempbuf, state->
wbuf + i, (state->
lastchar - i) *
sizeof(
wchar_t)) == 0))
557 else if ((flags &
MUTT_ALIAS) && (ch == OP_EDITOR_COMPLETE))
562 (i > 0) && (state->
wbuf[i - 1] !=
',') && (state->
wbuf[i - 1] !=
':'); i--)
565 for (; (i < state->
lastchar) && (state->
wbuf[i] ==
' '); i++)
578 else if ((flags &
MUTT_LABEL) && (ch == OP_EDITOR_COMPLETE))
582 (i > 0) && (state->
wbuf[i - 1] !=
',') && (state->
wbuf[i - 1] !=
':'); i--)
585 for (; (i < state->
lastchar) && (state->
wbuf[i] ==
' '); i++)
598 else if ((flags &
MUTT_PATTERN) && (ch == OP_EDITOR_COMPLETE))
601 if (i && (state->
wbuf[i - 1] ==
'~'))
608 for (; (i > 0) && (state->
wbuf[i - 1] !=
'~'); i--)
611 if ((i > 0) && (i < state->
curpos) && (state->
wbuf[i - 1] ==
'~') &&
612 (state->
wbuf[i] ==
'y'))
628 else if ((flags &
MUTT_ALIAS) && (ch == OP_EDITOR_COMPLETE_QUERY))
633 for (; (i > 0) && (state->
wbuf[i - 1] !=
','); i--)
636 for (; (i < state->
curpos) && (state->
wbuf[i] ==
' '); i++)
650 size_t i = strlen(buf);
651 if ((i != 0) && (buf[i - 1] ==
'=') &&
665 if ((!tempbuf && !state->
lastchar) ||
666 (tempbuf && (templen == state->
lastchar) &&
667 (memcmp(tempbuf, state->
wbuf, state->
lastchar *
sizeof(
wchar_t)) == 0)))
691 memcpy(tempbuf, state->
wbuf, templen *
sizeof(
wchar_t));
701 size_t len = strlen(buf);
720 case OP_EDITOR_QUOTE_CHAR:
726 }
while (event.
ch == -2);
735 case OP_EDITOR_TRANSPOSE_CHARS:
772 size_t k = mbrtowc(&wc, &c, 1, &mbstate);
773 if (k == (
size_t)(-2))
775 else if ((k != 0) && (k != 1))
777 memset(&mbstate, 0,
sizeof(mbstate));
792 if ((wc ==
'\r') || (wc ==
'\n'))
801 char **tfiles = NULL;
811 else if (wc && ((wc <
' ') ||
IsWPrint(wc)))
int mutt_mb_wcswidth(const wchar_t *s, size_t n)
Measure the screen width of a string.
void mutt_hist_reset_state(enum HistoryClass hclass)
Move the 'current' position to the end of the History.
void mutt_beep(bool force)
Irritate the user.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
int mutt_addwch(wchar_t wc)
addwch would be provided by an up-to-date curses library
String manipulation buffer.
void mutt_hist_complete(char *buf, size_t buflen, enum HistoryClass hclass)
Complete a string from a history list.
#define MUTT_PATTERN
Pattern mode - only used for history classes.
#define MUTT_SEL_NO_FLAGS
No flags are set.
void mutt_hist_add(enum HistoryClass hclass, const char *str, bool save)
Add a string to a history.
char * mutt_str_dup(const char *str)
Copy a string, safely.
struct EnterState * mutt_enter_state_new(void)
Create a new EnterState.
@ ENTER_REDRAW_INIT
Go to end of line and redraw.
int LastKey
contains the last key the user pressed
#define MUTT_LABEL
Do label completion.
struct Mailbox * mutt_mailbox_next(struct Mailbox *m_cur, struct Buffer *s)
incoming folders completion routine
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
@ ENTER_REDRAW_LINE
Redraw entire line.
int query_complete(char *buf, size_t buflen, struct ConfigSubset *sub)
Perform auto-complete using an Address Query.
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
#define MUTT_ALIAS
Do alias "completion" by calling up the alias-menu.
int mutt_label_complete(char *buf, size_t buflen, int numtabs)
Complete a label name.
bool mutt_hist_at_scratch(enum HistoryClass hclass)
Is the current History position at the 'scratch' place?
#define MUTT_FILE
Do file completion.
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
HistoryClass
Type to differentiate different histories.
int mutt_enter_string(char *buf, size_t buflen, int col, CompletionFlags flags)
Ask the user for a string.
#define MUTT_EFILE
Do file completion, plus incoming folders.
size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1)
Keep the end of the string on-screen.
int mutt_command_complete(char *buf, size_t buflen, int pos, int numtabs)
Complete a command name.
#define MUTT_SEL_FOLDER
Select a local directory.
bool mutt_nm_tag_complete(char *buf, size_t buflen, int numtabs)
Complete to the nearest notmuch tag.
bool mutt_mb_is_shell_char(wchar_t ch)
Is character not typically part of a pathname.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
#define MUTT_SEL_MULTI
Multi-selection is enabled.
int mutt_complete(char *buf, size_t buflen)
Attempt to complete a partial pathname.
An event such as a keypress.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str)
Save a temporary string to the History.
EnterRedrawFlags
redraw flags for mutt_enter_string_full()
void mutt_flushinp(void)
Empty all the keyboard buffers.
struct WindowState state
Current state of the Window.
bool mutt_nm_query_complete(char *buf, size_t buflen, int pos, int numtabs)
Complete to the nearest notmuch tag.
#define MUTT_PASS
Password mode (no echo)
#define MUTT_NM_TAG
Notmuch tag +/- mode.
static int my_addwch(wchar_t wc)
Display one wide character on screen.
Keep our place when entering a string.
Container for Accounts, Notifications.
int mutt_enter_string_full(char *buf, size_t buflen, int col, CompletionFlags flags, bool multiple, struct Mailbox *m, char ***files, int *numfiles, struct EnterState *state)
Ask the user for a string.
int mutt_mb_wcwidth(wchar_t wc)
Measure the screen width of a character.
static void replace_part(struct EnterState *state, size_t from, char *buf)
Search and replace on a buffer.
WHERE bool C_AbortBackspace
Config: Hitting backspace against an empty prompt aborts the prompt.
@ HC_OTHER
Miscellaneous strings.
@ MENU_EDITOR
Text entry area.
#define MUTT_CMD
Do completion on previous word.
@ HC_CMD
External commands.
#define MUTT_CLEAR
Clear input if printable character is pressed.
void mutt_refresh(void)
Force a refresh of the screen.
void mutt_select_file(char *file, size_t filelen, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file.
struct ConfigSubset * sub
Inherited config items.
@ ENTER_REDRAW_NONE
Nothing to redraw.
#define MUTT_COMMAND
Do command completion.
int alias_complete(char *buf, size_t buflen, struct ConfigSubset *sub)
alias completion routine
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
void mutt_mb_wcstombs(char *dest, size_t dlen, const wchar_t *src, size_t slen)
Convert a string from wide to multibyte characters.
char * mutt_hist_prev(enum HistoryClass hclass)
Get the previous string in a History.
int mutt_var_value_complete(char *buf, size_t buflen, int pos)
Complete a variable/value.
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using '~' or '='.
bool dlg_select_pattern(char *buf, size_t buflen)
Show menu to select a Pattern.
void mutt_enter_state_free(struct EnterState **ptr)
Free an EnterState.
@ HC_COMMAND
NeoMutt commands.
char * mutt_hist_next(enum HistoryClass hclass)
Get the next string in a History.
uint16_t CompletionFlags
Flags for mutt_enter_string_full(), e.g. MUTT_ALIAS.
size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf)
Convert a string from multibyte to wide characters.
#define MUTT_NM_QUERY
Notmuch query mode.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)