NeoMutt  2019-12-07-60-g0cfa53
Teaching an old dog new tricks
DOXYGEN
curs_lib.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_CURS_LIB_H
24 #define MUTT_CURS_LIB_H
25 
26 #include <stddef.h>
27 #include <stdbool.h>
28 #include <wchar.h>
29 #include "config/lib.h"
30 #include "mutt.h"
31 #include "browser.h"
32 #include "keymap.h"
33 #include "pager.h"
34 
35 struct Buffer;
36 
37 /* These Config Variables are only used in curs_lib.c */
38 extern bool C_MetaKey;
39 
40 extern int MuttGetchTimeout;
41 
46 {
47  JUSTIFY_LEFT = -1,
50 };
51 
52 int mutt_addwch(wchar_t wc);
53 int mutt_any_key_to_continue(const char *s);
54 void mutt_beep(bool force);
55 int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info);
56 void mutt_edit_file(const char *editor, const char *file);
57 void mutt_endwin(void);
58 int mutt_enter_fname_full(const char *prompt, char *buf, size_t buflen, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags);
59 void mutt_flushinp(void);
62 void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s);
63 void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s);
64 void mutt_format_s_x(char *buf, size_t buflen, const char *prec, const char *s, bool arboreal);
65 void mutt_getch_timeout(int delay);
66 struct KeyEvent mutt_getch(void);
67 int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles);
68 int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, CompletionFlags flags);
69 int mutt_multi_choice(const char *prompt, const char *letters);
70 void mutt_need_hard_redraw(void);
71 void mutt_paddstr(int n, const char *s);
72 void mutt_perror_debug(const char *s);
73 void mutt_push_macro_event(int ch, int op);
74 void mutt_query_exit(void);
75 void mutt_refresh(void);
76 void mutt_show_error(void);
77 void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal);
78 int mutt_strwidth(const char *s);
79 int mutt_strnwidth(const char *s, size_t len);
80 void mutt_unget_event(int ch, int op);
81 void mutt_unget_string(const char *s);
82 size_t mutt_wstr_trunc(const char *src, size_t maxlen, size_t maxwid, size_t *width);
83 enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def);
84 
85 #define mutt_buffer_get_field(field, buf, complete) mutt_buffer_get_field_full(field, buf, complete, 0, NULL, NULL)
86 int mutt_buffer_get_field_full(const char *field, struct Buffer *buf, CompletionFlags complete, bool multiple, char ***files, int *numfiles);
87 
88 #define mutt_buffer_enter_fname(prompt, fname, mailbox) mutt_buffer_enter_fname_full(prompt, fname, mailbox, false, NULL, NULL, MUTT_SEL_NO_FLAGS)
89 int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags);
90 
91 #define mutt_enter_fname(prompt, buf, buflen, mailbox) mutt_enter_fname_full(prompt, buf, buflen, mailbox, false, NULL, NULL, 0)
92 #define mutt_get_field(field, buf, buflen, complete) mutt_get_field_full(field, buf, buflen, complete, false, NULL, NULL)
93 #define mutt_get_password(msg, buf, buflen) mutt_get_field_unbuffered(msg, buf, buflen, MUTT_PASS)
94 
95 #endif /* MUTT_CURS_LIB_H */
Manage keymappings.
void mutt_unget_string(const char *s)
Return a string to the input buffer.
Definition: curs_lib.c:853
Left justify the text.
Definition: curs_lib.h:47
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
FormatJustify
Alignment for mutt_simple_format()
Definition: curs_lib.h:45
bool C_MetaKey
interpret ALT-x as ESC-x
Definition: curs_lib.c:70
int MuttGetchTimeout
Timeout in ms for mutt_getch()
Definition: curs_lib.c:91
uint16_t CompletionFlags
Flags for mutt_enter_string_full(), e.g. MUTT_ALIAS.
Definition: mutt.h:61
void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal)
Format a string, like snprintf()
Definition: curs_lib.c:1093
int mutt_strnwidth(const char *s, size_t len)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1372
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
Definition: curs_lib.c:513
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string.
Definition: curs_lib.c:1244
Right justify the text.
Definition: curs_lib.h:49
String manipulation buffer.
Definition: buffer.h:33
int op
function op
Definition: keymap.h:63
int ch
raw key pressed
Definition: keymap.h:62
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:376
void mutt_perror_debug(const char *s)
Show the user an &#39;errno&#39; message.
Definition: curs_lib.c:564
void mutt_show_error(void)
Show the user an error message.
Definition: curs_lib.c:531
An email being displayed.
Definition: pager.h:65
Convenience wrapper for the config headers.
GUI component for displaying/selecting items from a list.
int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info)
Display some page-able text to the user.
Definition: curs_lib.c:664
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
Definition: curs_lib.c:933
Centre the text.
Definition: curs_lib.h:48
void mutt_beep(bool force)
Irritate the user.
Definition: curs_lib.c:97
int mutt_buffer_get_field_full(const char *field, struct Buffer *buf, CompletionFlags complete, bool multiple, char ***files, int *numfiles)
Ask the user for a string.
Definition: curs_lib.c:257
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.
Definition: curs_lib.c:1309
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1266
int mutt_addwch(wchar_t wc)
addwch would be provided by an up-to-date curses library
Definition: curs_lib.c:1059
uint16_t PagerFlags
Flags for mutt_pager(), e.g. MUTT_SHOWFLAT.
Definition: pager.h:42
void mutt_format_s_x(char *buf, size_t buflen, const char *prec, const char *s, bool arboreal)
Format a string like snprintf()
Definition: curs_lib.c:1207
int mutt_enter_fname_full(const char *prompt, char *buf, size_t buflen, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file.
Definition: curs_lib.c:742
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:834
int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, CompletionFlags flags)
Ask the user for a string (ignoring macro buffer)
Definition: curs_lib.c:331
An event such as a keypress.
Definition: keymap.h:60
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:545
int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file.
Definition: curs_lib.c:768
GUI display a file/email/help in a viewport with paging.
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
void mutt_flush_unget_to_endcond(void)
Clear entries from UngetKeyEvents.
Definition: curs_lib.c:907
int mutt_any_key_to_continue(const char *s)
Prompt the user to &#39;press any key&#39; and wait.
Definition: curs_lib.c:578
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1359
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
Definition: curs_lib.c:352
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: curs_lib.c:890
void mutt_getch_timeout(int delay)
Set the getch() timeout.
Definition: curs_lib.c:144
void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string with tree characters.
Definition: curs_lib.c:1256
void mutt_need_hard_redraw(void)
Force a hard refresh.
Definition: curs_lib.c:128
int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles)
Ask the user for a string.
Definition: curs_lib.c:308
void mutt_push_macro_event(int ch, int op)
Add the character/operation to the macro buffer.
Definition: curs_lib.c:871
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:919
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
uint8_t SelectFileFlags
Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.
Definition: browser.h:43