NeoMutt  2018-07-16 +2481-68dcde
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 <stdio.h>
29 #include "config/lib.h"
30 #include "mutt.h"
31 #include "browser.h"
32 #include "pager.h"
33 
34 struct Buffer;
35 
36 /* These Config Variables are only used in curs_lib.c */
37 extern bool C_MetaKey;
39 extern int MuttGetchTimeout;
40 
45 {
46  JUSTIFY_LEFT = -1,
49 };
50 
51 int mutt_addwch(wchar_t wc);
52 int mutt_any_key_to_continue(const char *s);
53 int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info);
54 void mutt_edit_file(const char *editor, const char *file);
55 void mutt_endwin(void);
56 int mutt_enter_fname_full(const char *prompt, char *buf, size_t buflen, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags);
57 void mutt_flushinp(void);
60 void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s);
61 void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s);
62 void mutt_format_s_x(char *buf, size_t buflen, const char *prec, const char *s, bool arboreal);
63 void mutt_getch_timeout(int delay);
64 struct KeyEvent mutt_getch(void);
65 int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles);
66 int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, CompletionFlags flags);
67 int mutt_multi_choice(const char *prompt, const char *letters);
68 void mutt_need_hard_redraw(void);
69 void mutt_paddstr(int n, const char *s);
70 void mutt_perror_debug(const char *s);
71 void mutt_push_macro_event(int ch, int op);
72 void mutt_query_exit(void);
73 void mutt_refresh(void);
74 void mutt_show_error(void);
75 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);
76 int mutt_strwidth(const char *s);
77 void mutt_unget_event(int ch, int op);
78 void mutt_unget_string(const char *s);
79 size_t mutt_wstr_trunc(const char *src, size_t maxlen, size_t maxwid, size_t *width);
80 enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def);
81 
82 #define mutt_buffer_enter_fname(prompt, fname, mailbox) mutt_buffer_enter_fname_full(prompt, fname, mailbox, false, NULL, NULL, MUTT_SEL_NO_FLAGS)
83 int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags);
84 
85 #define mutt_enter_fname(prompt, buf, buflen, mailbox) mutt_enter_fname_full(prompt, buf, buflen, mailbox, false, NULL, NULL, 0)
86 #define mutt_get_field(field, buf, buflen, complete) mutt_get_field_full(field, buf, buflen, complete, false, NULL, NULL)
87 #define mutt_get_password(msg, buf, buflen) mutt_get_field_unbuffered(msg, buf, buflen, MUTT_PASS)
88 
89 #endif /* MUTT_CURS_LIB_H */
void mutt_unget_string(const char *s)
Return a string to the input buffer.
Definition: curs_lib.c:738
Left justify the text.
Definition: curs_lib.h:46
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:175
FormatJustify
Alignment for mutt_simple_format()
Definition: curs_lib.h:44
bool C_MetaKey
interpret ALT-x as ESC-x
Definition: curs_lib.c:68
int MuttGetchTimeout
Timeout in ms for mutt_getch()
Definition: curs_lib.c:89
uint16_t CompletionFlags
Flags for mutt_enter_string_full(), e.g. MUTT_ALIAS.
Definition: mutt.h:63
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:1000
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
Definition: curs_lib.c:467
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string.
Definition: curs_lib.c:1151
Right justify the text.
Definition: curs_lib.h:48
String manipulation buffer.
Definition: buffer.h:33
int op
function op
Definition: mutt_curses.h:111
int ch
raw key pressed
Definition: mutt_curses.h:110
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:332
void mutt_perror_debug(const char *s)
Show the user an &#39;errno&#39; message.
Definition: curs_lib.c:518
void mutt_show_error(void)
Show the user an error message.
Definition: curs_lib.c:485
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:586
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
Definition: curs_lib.c:843
Many unsorted constants and some structs.
Centre the text.
Definition: curs_lib.h:47
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:1216
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1173
int mutt_addwch(wchar_t wc)
addwch would be provided by an up-to-date curses library
Definition: curs_lib.c:966
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:1114
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:626
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:719
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:287
An event such as a keypress.
Definition: mutt_curses.h:108
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:499
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:652
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:94
void mutt_flush_unget_to_endcond(void)
Clear entries from UngetKeyEvents.
Definition: curs_lib.c:792
int mutt_any_key_to_continue(const char *s)
Prompt the user to &#39;press any key&#39; and wait.
Definition: curs_lib.c:532
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1266
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
Definition: curs_lib.c:308
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: curs_lib.c:775
void mutt_getch_timeout(int delay)
Set the getch() timeout.
Definition: curs_lib.c:132
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:1163
void mutt_need_hard_redraw(void)
Force a hard refresh.
Definition: curs_lib.c:116
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:246
void mutt_push_macro_event(int ch, int op)
Add the character/operation to the macro buffer.
Definition: curs_lib.c:756
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:804
QuadOption
Possible values for a quad-option.
Definition: quad.h:35
uint8_t SelectFileFlags
Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.
Definition: browser.h:43