59 new_size =
ROUND_UP(new_size + 2, 512);
81 if (!dest || !user || !src)
84 if (strstr(src, user) != src)
96 for (l = 0; (src[l] !=
'\0') && (src[l] == dest[l]); l++)
109 const char *pa = *(
const char **) a;
110 const char *pb = *(
const char **) b;
126 int pos,
int numtabs,
void *cdata)
128 char *pt = buf->
data;
132 spaces = pt - buf->
data;
134 pt = buf->
data + pos - spaces;
148 const struct Command **cp = NULL;
151 const struct Command *cmd = *cp;
160 const char *real_name = cmd->
help;
174 for (l = 0; (real_name[l] !=
'\0') && (real_name[l] == cd->
completed[l]); l++)
217 static const char *
const prefixes[] = {
"no",
"inv",
"?",
"&", 0 };
223 for (
int num = 0; prefixes[num]; num++)
297 mtype = menu->
md->
id;
309 const char **strp = NULL;
355static int label_sort(
const void *a,
const void *b,
void *sdata)
357 return strcasecmp(*(
const char **) a, *(
const char **) b);
370 char *pt = buf->
data;
432 char *pt = buf->
data;
438 const int spaces = pt - buf->
data;
440 pt = buf->
data + pos - spaces;
449 char var[256] = { 0 };
456 var[vlen - 1] =
'\0';
468 snprintf(pt, buf->
dsize - (pt - buf->
data),
"%s=%s", var, pretty->
data);
485 if (!wdata || ((op != OP_EDITOR_COMPLETE) && (op != OP_EDITOR_COMPLETE_QUERY)))
491 if ((i != 0) && (
buf_at(wdata->
buffer, i - 1) ==
'=') &&
510 if (!wdata || ((op != OP_EDITOR_COMPLETE) && (op != OP_EDITOR_COMPLETE_QUERY)))
#define ARRAY_SORT(head, fn, sdata)
Sort an array.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_FREE(head)
Release all memory.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t buf_startswith(const struct Buffer *buf, const char *prefix)
Check whether a buffer starts with a prefix.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
#define CF_SYNONYM
Command is a synonym for another command.
int mutt_var_value_complete(struct CompletionData *cd, struct Buffer *buf, int pos)
Complete a variable/value.
void matches_ensure_morespace(struct CompletionData *cd, int new_size)
Allocate more space for auto-completion.
int mutt_label_complete(struct CompletionData *cd, struct Buffer *buf, int numtabs)
Complete a label name.
const struct CompleteOps CompleteLabelOps
Auto-Completion of Labels.
const struct CompleteOps CompleteCommandOps
Auto-Completion of Commands.
int mutt_command_complete(struct CompletionData *cd, struct Buffer *buf, int pos, int numtabs, void *cdata)
Complete a command name.
bool candidate(struct CompletionData *cd, char *user, const char *src, char *dest, size_t dlen)
Helper function for completion.
size_t pretty_var(const char *str, struct Buffer *buf)
Escape and stringify a config item value.
Convenience wrapper for the config headers.
#define CSR_RESULT(x)
Extract the result code from CSR_* flags.
#define CSR_SUCCESS
Action completed successfully.
Convenience wrapper for the core headers.
bool mutt_isspace(int arg)
Wrapper for isspace(3)
String auto-completion data.
FunctionRetval
Possible return values for NeoMutt functions.
@ FR_SUCCESS
Valid function - successfully performed.
@ FR_ERROR
Valid function - error occurred.
@ FR_CONTINUE
Remain in the Dialog.
@ FR_NO_ACTION
Valid function - no action performed.
void replace_part(struct EnterState *es, size_t from, const char *buf)
Search and replace on a buffer.
enum FunctionRetval complete_label(struct EnterWindowData *wdata, int op)
Complete a label - Implements CompleteOps::complete() -.
enum FunctionRetval complete_command(struct EnterWindowData *wdata, int op)
Complete a NeoMutt Command - Implements CompleteOps::complete() -.
static int complete_sort_strings(const void *a, const void *b, void *sdata)
Compare two strings - Implements sort_t -.
static int label_sort(const void *a, const void *b, void *sdata)
Compare two label strings - Implements sort_t -.
Convenience wrapper for the gui headers.
struct HashElem * mutt_hash_walk(const struct HashTable *table, struct HashWalkState *state)
Iterate through all the HashElem's in a Hash Table.
GUI manage the main index (list of emails)
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
struct StringArray km_get_func_array(const struct MenuDefinition *md)
Get array of function names for a Menu.
void buf_mb_wcstombs(struct Buffer *dest, const wchar_t *wstr, size_t wlen)
Convert a string from wide to multibyte characters.
#define ROUND_UP(NUM, STEP)
Round up NUM to the nearest multiple of STEP.
#define MUTT_MEM_REALLOC(pptr, n, type)
Convenience wrapper for the library headers.
int mutt_str_cmp(const char *a, const char *b)
Compare two strings, safely.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
@ WT_MENU
An Window containing a Menu.
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.
void mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
CommandFlags flags
Command flags, e.g. CF_SYNONYM.
const char * help
One-line description of the Command.
const char * name
Name of the Command.
State data for auto-completion.
int match_list_len
Enough space for all of the config items.
char user_typed[1024]
Initial string that starts completion.
char completed[256]
Completed string (command or variable)
int num_matched
Number of matches for completion.
const char ** match_list
Matching strings.
struct ConfigSet * cs
Parent ConfigSet.
size_t curpos
Position of the cursor.
wchar_t * wbuf
Buffer for the string being entered.
size_t lastchar
Position of the last character.
Data to fill the Enter Window.
int tabs
Number of times the user has hit tab.
void * cdata
Auto-Completion private data.
struct CompletionData * cd
Auto-completion state data.
struct Buffer * buffer
struct Buffer for the result
struct EnterState * state
Current state of text entry.
Input for the file completion function.
struct MuttWindow * win
Current Focused Window.
The item stored in a Hash Table.
union HashKey key
Key representing the data.
Cursor to iterate through a Hash Table.
struct HashTable * label_hash
Hash Table: "X-Label" -> Email.
void * wdata
Private data.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Container for Accounts, Notifications.
struct CommandArray commands
NeoMutt commands.
struct ConfigSubset * sub
Inherited config items.
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags)
Create a sorted list of all config items.
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
@ GEL_ALL_CONFIG
All the normal config (no synonyms or deprecated)
MenuType
Types of GUI selections.
@ MENU_GENERIC
Generic selection list.
const char * strkey
String key.