]> granicus.if.org Git - neomutt/commitdiff
add typedef for CompletionFlags
authorRichard Russon <rich@flatcap.org>
Tue, 26 Feb 2019 23:35:15 +0000 (23:35 +0000)
committerRichard Russon <rich@flatcap.org>
Fri, 1 Mar 2019 13:09:43 +0000 (13:09 +0000)
config/set.h
curs_lib.c
curs_lib.h
enter.c
mutt.h
protos.h

index 357d2c5b014fffe0c0887be81d421829a759b2f2..f0f413d80f478064e3802df9544113c7481f1848 100644 (file)
@@ -162,7 +162,7 @@ struct ConfigDef
 {
   const char   *name;      /**< User-visible name */
   unsigned int  type;      /**< Variable type, e.g. #DT_STRING */
-  intptr_t      flags;     /**< Notification flags, e.g. #R_PAGER */
+  intptr_t      flags;     /**< Notification flags, see #ConfigRedrawFlags */
   void         *var;       /**< Pointer to the global variable */
   intptr_t      initial;   /**< Initial value */
   cs_validator  validator; /**< Validator callback function */
index df8e6ba6a6d495d5fffc244d3fcce5e8c6f5b285..08da92c661e6cf3bd0b3fae72b456d96c28daff7 100644 (file)
@@ -240,7 +240,7 @@ struct Event mutt_getch(void)
  * @param[in]  field    Prompt
  * @param[in]  buf      Buffer for the result
  * @param[in]  buflen   Length of buffer
- * @param[in]  complete Flags for completion, e.g. #MUTT_FILE
+ * @param[in]  complete Flags, see #CompletionFlags
  * @param[in]  multiple Allow multiple selections
  * @param[out] files    List of files selected
  * @param[out] numfiles Number of files selected
@@ -248,8 +248,8 @@ struct Event mutt_getch(void)
  * @retval 0  Selection made
  * @retval -1 Aborted
  */
-int mutt_get_field_full(const char *field, char *buf, size_t buflen,
-                        int complete, bool multiple, char ***files, int *numfiles)
+int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete,
+                        bool multiple, char ***files, int *numfiles)
 {
   int ret;
   int x;
@@ -284,12 +284,12 @@ int mutt_get_field_full(const char *field, char *buf, size_t buflen,
  * @param msg    Prompt
  * @param buf    Buffer for the result
  * @param buflen Length of buffer
- * @param flags  Flags for completion, e.g. #MUTT_FILE
+ * @param flags  Flags, see #CompletionFlags
  * @retval 1  Redraw the screen and call the function again
  * @retval 0  Selection made
  * @retval -1 Aborted
  */
-int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, int flags)
+int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, CompletionFlags flags)
 {
   int rc;
 
index ec9d720ad4329d34f78c6233fdf2b195aa4eae2d..b18231be6b8b4645a6550796b5b9a9c0700a6c39 100644 (file)
@@ -55,8 +55,8 @@ void         mutt_format_s(char *buf, size_t buflen, const char *prec, const cha
 void         mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s);
 void         mutt_getch_timeout(int delay);
 struct Event mutt_getch(void);
-int          mutt_get_field_full(const char *field, char *buf, size_t buflen, int complete, bool multiple, char ***files, int *numfiles);
-int          mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, int flags);
+int          mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles);
+int          mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, CompletionFlags flags);
 int          mutt_multi_choice(const char *prompt, const char *letters);
 void         mutt_need_hard_redraw(void);
 void         mutt_paddstr(int n, const char *s);
diff --git a/enter.c b/enter.c
index b784c844115a4fa980885e57d67d71f74f22e106..9f9c5d5d9f86273056b00ff39e4c0776a7fa6aa8 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -133,7 +133,7 @@ struct EnterState *mutt_enter_state_new(void)
  * @param buf    Buffer to store the string
  * @param buflen Buffer length
  * @param col    Initial cursor position
- * @param flags  Flags such as MUTT_FILE
+ * @param flags  Flags, see #CompletionFlags
  * @retval 0 if input was given
  * @retval -1 if abort
  *
@@ -142,7 +142,7 @@ struct EnterState *mutt_enter_state_new(void)
  * well, because there is no active menu for the built-in editor.
  * Most callers should prefer mutt_get_field() instead.
  */
-int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
+int mutt_enter_string(char *buf, size_t buflen, int col, CompletionFlags flags)
 {
   int rc;
   struct EnterState *es = mutt_enter_state_new();
@@ -165,7 +165,7 @@ int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
  * @param[in]  buf      Buffer to store the string
  * @param[in]  buflen   Buffer length
  * @param[in]  col      Initial cursor position
- * @param[in]  flags    Flags such as MUTT_FILE
+ * @param[in]  flags    Flags, see #CompletionFlags
  * @param[in]  multiple Allow multiple matches
  * @param[out] files    List of files selected
  * @param[out] numfiles Number of files selected
@@ -174,8 +174,9 @@ int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
  * @retval 0  Selection made
  * @retval -1 Aborted
  */
-int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, bool multiple,
-                           char ***files, int *numfiles, struct EnterState *state)
+int mutt_enter_string_full(char *buf, size_t buflen, int col,
+                           CompletionFlags flags, bool multiple, char ***files,
+                           int *numfiles, struct EnterState *state)
 {
   int width = MuttMessageWindow->cols - col - 1;
   int redraw;
diff --git a/mutt.h b/mutt.h
index bcd090c9b001555c556243f8da2179440a9c807a..e5fffe8b98c2fe34c2a7d79d4055fa032d2aa5dd 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -55,7 +55,8 @@ struct Mapping;
 #define fgetc fgetc_unlocked
 #endif
 
-/* flags for mutt_enter_string_full() */
+typedef uint16_t CompletionFlags;    ///< Flags for mutt_enter_string_full(), e.g. #MUTT_ALIAS
+#define MUTT_COMP_NO_FLAGS       0   ///< No flags are set
 #define MUTT_ALIAS         (1 << 0)  ///< Do alias "completion" by calling up the alias-menu
 #define MUTT_FILE          (1 << 1)  ///< Do file completion
 #define MUTT_EFILE         (1 << 2)  ///< Do file completion, plus incoming folders
index 2c24248c6a7d3c9f43632c8731be469307883805..461fb8b3d2fdb2fb94c147b09431720d3f01d00f 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <time.h>
 #include "config/lib.h"
+#include "mutt.h"
 
 struct Context;
 struct EnterState;
@@ -70,9 +71,9 @@ int mutt_change_flag(struct Mailbox *m, struct EmailList *el, int bf);
 
 int mutt_complete(char *buf, size_t buflen);
 int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, struct Email *e, bool resend);
-int mutt_enter_string(char *buf, size_t buflen, int col, int flags);
-int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, bool multiple,
-                       char ***files, int *numfiles, struct EnterState *state);
+int mutt_enter_string(char *buf, size_t buflen, int col, CompletionFlags flags);
+int mutt_enter_string_full(char *buf, size_t buflen, int col, CompletionFlags flags, bool multiple,
+                           char ***files, int *numfiles, struct EnterState *state);
 int mutt_get_postponed(struct Context *ctx, struct Email *e, struct Email **cur, char *fcc, size_t fcclen);
 int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app);
 int mutt_num_postponed(struct Mailbox *m, bool force);