GUI miscellaneous curses (window drawing) routines. More...
Go to the source code of this file.
Enumerations | |
enum | FormatJustify { JUSTIFY_LEFT = -1 , JUSTIFY_CENTER = 0 , JUSTIFY_RIGHT = 1 } |
Alignment for mutt_simple_format() More... | |
Functions | |
int | mutt_addwch (struct MuttWindow *win, wchar_t wc) |
Addwch would be provided by an up-to-date curses library. More... | |
int | mutt_any_key_to_continue (const char *s) |
Prompt the user to 'press any key' and wait. More... | |
void | mutt_beep (bool force) |
Irritate the user. More... | |
int | buf_enter_fname (const char *prompt, struct Buffer *fname, bool mailbox, struct Mailbox *m, bool multiple, char ***files, int *numfiles, SelectFileFlags flags) |
Ask the user to select a file. More... | |
void | mutt_edit_file (const char *editor, const char *file) |
Let the user edit a file. More... | |
void | mutt_endwin (void) |
Shutdown curses. More... | |
void | mutt_flushinp (void) |
Empty all the keyboard buffers. More... | |
void | mutt_flush_macro_to_endcond (void) |
Drop a macro from the input buffer. More... | |
void | mutt_flush_unget_to_endcond (void) |
Clear entries from UngetKeyEvents. More... | |
void | mutt_format_s (char *buf, size_t buflen, const char *prec, const char *s) |
Format a simple string. More... | |
void | mutt_format_s_tree (char *buf, size_t buflen, const char *prec, const char *s) |
Format a simple string with tree characters. More... | |
void | mutt_format_s_x (char *buf, size_t buflen, const char *prec, const char *s, bool arboreal) |
Format a string like snprintf() More... | |
struct KeyEvent | mutt_getch_timeout (int delay) |
Get an event with a timeout. More... | |
struct KeyEvent | mutt_getch (void) |
Read a character from the input buffer. More... | |
void | mutt_need_hard_redraw (void) |
Force a hard refresh. More... | |
void | mutt_paddstr (struct MuttWindow *win, int n, const char *s) |
Display a string on screen, padded if necessary. More... | |
void | mutt_perror_debug (const char *s) |
Show the user an 'errno' message. More... | |
void | mutt_push_macro_event (int ch, int op) |
Add the character/operation to the macro buffer. More... | |
void | mutt_query_exit (void) |
Ask the user if they want to leave NeoMutt. More... | |
void | mutt_refresh (void) |
Force a refresh of the screen. More... | |
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() More... | |
size_t | mutt_strwidth (const char *s) |
Measure a string's width in screen cells. More... | |
size_t | mutt_strnwidth (const char *s, size_t len) |
Measure a string's width in screen cells. More... | |
void | mutt_unget_ch (int ch) |
Return a keystroke to the input buffer. More... | |
void | mutt_unget_op (int op) |
Return an operation to the input buffer. More... | |
void | mutt_unget_string (const char *s) |
Return a string to the input buffer. More... | |
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. More... | |
Variables | |
int | MuttGetchTimeout |
Timeout in ms for mutt_getch() More... | |
GUI miscellaneous curses (window drawing) routines.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file curs_lib.h.
enum FormatJustify |
Alignment for mutt_simple_format()
Enumerator | |
---|---|
JUSTIFY_LEFT | Left justify the text. |
JUSTIFY_CENTER | Centre the text. |
JUSTIFY_RIGHT | Right justify the text. |
Definition at line 40 of file curs_lib.h.
int mutt_addwch | ( | struct MuttWindow * | win, |
wchar_t | wc | ||
) |
Addwch would be provided by an up-to-date curses library.
win | Window |
wc | Wide char to display |
0 | Success |
-1 | Error |
Definition at line 607 of file curs_lib.c.
int mutt_any_key_to_continue | ( | const char * | s | ) |
Prompt the user to 'press any key' and wait.
s | Message prompt |
num | Key pressed |
EOF | Error, or prompt aborted |
Definition at line 388 of file curs_lib.c.
void mutt_beep | ( | bool | force | ) |
Irritate the user.
force | If true, ignore the "$beep" config variable |
Definition at line 131 of file curs_lib.c.
int buf_enter_fname | ( | const char * | prompt, |
struct Buffer * | fname, | ||
bool | mailbox, | ||
struct Mailbox * | m, | ||
bool | multiple, | ||
char *** | files, | ||
int * | numfiles, | ||
SelectFileFlags | flags | ||
) |
Ask the user to select a file.
[in] | prompt | Prompt |
[in] | fname | Buffer for the result |
[in] | mailbox | If true, select mailboxes |
[in] | multiple | Allow multiple selections |
[in] | m | Mailbox |
[out] | files | List of files selected |
[out] | numfiles | Number of files selected |
[in] | flags | Flags, see SelectFileFlags |
0 | Success |
-1 | Error |
Definition at line 446 of file curs_lib.c.
void mutt_edit_file | ( | const char * | editor, |
const char * | file | ||
) |
Let the user edit a file.
editor | User's editor config |
file | File to edit |
Definition at line 313 of file curs_lib.c.
void mutt_endwin | ( | void | ) |
Shutdown curses.
Definition at line 355 of file curs_lib.c.
void mutt_flushinp | ( | void | ) |
Empty all the keyboard buffers.
Definition at line 593 of file curs_lib.c.
void mutt_flush_macro_to_endcond | ( | void | ) |
Drop a macro from the input buffer.
All the macro text is deleted until an OP_END_COND command, or the buffer is empty.
Definition at line 573 of file curs_lib.c.
void mutt_flush_unget_to_endcond | ( | void | ) |
Clear entries from UngetKeyEvents.
Normally, OP_END_COND should only be in the MacroEvent buffer. km_error_key() (ab)uses OP_END_COND as a barrier in the unget buffer, and calls this function to flush.
Definition at line 585 of file curs_lib.c.
void mutt_format_s | ( | char * | buf, |
size_t | buflen, | ||
const char * | prec, | ||
const char * | s | ||
) |
Format a simple string.
[out] | buf | Buffer in which to save string |
[in] | buflen | Buffer length |
[in] | prec | Field precision, e.g. "-3.4" |
[in] | s | String to format |
Definition at line 796 of file curs_lib.c.
void mutt_format_s_tree | ( | char * | buf, |
size_t | buflen, | ||
const char * | prec, | ||
const char * | s | ||
) |
Format a simple string with tree characters.
[out] | buf | Buffer in which to save string |
[in] | buflen | Buffer length |
[in] | prec | Field precision, e.g. "-3.4" |
[in] | s | String to format |
Definition at line 808 of file curs_lib.c.
void mutt_format_s_x | ( | char * | buf, |
size_t | buflen, | ||
const char * | prec, | ||
const char * | s, | ||
bool | arboreal | ||
) |
Format a string like snprintf()
[out] | buf | Buffer in which to save string |
[in] | buflen | Buffer length |
[in] | prec | Field precision, e.g. "-3.4" |
[in] | s | String to format |
[in] | arboreal | If true, string contains graphical tree characters |
This formats a string rather like:
Definition at line 759 of file curs_lib.c.
struct KeyEvent mutt_getch_timeout | ( | int | delay | ) |
Get an event with a timeout.
delay | Timeout delay in ms |
obj | KeyEvent to process, |
delay is just like for timeout() or poll(): the number of milliseconds mutt_getch() should block for input.
Definition at line 198 of file curs_lib.c.
struct KeyEvent mutt_getch | ( | void | ) |
Read a character from the input buffer.
obj | KeyEvent to process |
The priority for reading events is:
This function can return:
{ OP_ABORT, OP_NULL }
{ OP_TIMEOUT, OP_NULL }
Definition at line 243 of file curs_lib.c.
void mutt_need_hard_redraw | ( | void | ) |
Force a hard refresh.
Make sure that the next refresh does a full refresh. This could be optimized by not doing it at all if DISPLAY is set as this might indicate that a GUI based pinentry was used. Having an option to customize this is of course the NeoMutt way.
Definition at line 163 of file curs_lib.c.
void mutt_paddstr | ( | struct MuttWindow * | win, |
int | n, | ||
const char * | s | ||
) |
Display a string on screen, padded if necessary.
win | Window |
n | Final width of field |
s | String to display |
Definition at line 819 of file curs_lib.c.
void mutt_perror_debug | ( | const char * | s | ) |
Show the user an 'errno' message.
s | Additional text to show |
Definition at line 374 of file curs_lib.c.
void mutt_push_macro_event | ( | int | ch, |
int | op | ||
) |
Add the character/operation to the macro buffer.
ch | Character to add |
op | Operation to add |
Adds the ch/op to the macro buffer. This should be used for macros, push, and exec commands only.
Definition at line 562 of file curs_lib.c.
void mutt_query_exit | ( | void | ) |
Ask the user if they want to leave NeoMutt.
This function is called when the user presses the abort key.
Definition at line 336 of file curs_lib.c.
void mutt_refresh | ( | void | ) |
Force a refresh of the screen.
Definition at line 141 of file curs_lib.c.
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()
[out] | buf | Buffer in which to save string |
[in] | buflen | Buffer length |
[in] | min_width | Minimum width |
[in] | max_width | Maximum width |
[in] | justify | Justification, e.g. JUSTIFY_RIGHT |
[in] | pad_char | Padding character |
[in] | s | String to format |
[in] | n | Number of bytes of string to format |
[in] | arboreal | If true, string contains graphical tree characters |
This formats a string, a bit like snprintf(buf, buflen, "%-*.*s", min_width, max_width, s), except that the widths refer to the number of character cells when printed.
Definition at line 640 of file curs_lib.c.
size_t mutt_strwidth | ( | const char * | s | ) |
Measure a string's width in screen cells.
s | String to be measured |
num | Screen cells string would use |
Definition at line 914 of file curs_lib.c.
size_t mutt_strnwidth | ( | const char * | s, |
size_t | n | ||
) |
Measure a string's width in screen cells.
s | String to be measured |
n | Length of string to be measured |
num | Screen cells string would use |
Definition at line 927 of file curs_lib.c.
void mutt_unget_ch | ( | int | ch | ) |
Return a keystroke to the input buffer.
ch | Key press |
This puts events into the UngetKeyEvents
buffer
Definition at line 522 of file curs_lib.c.
void mutt_unget_op | ( | int | op | ) |
Return an operation to the input buffer.
op | Operation, e.g. OP_DELETE |
This puts events into the UngetKeyEvents
buffer
Definition at line 533 of file curs_lib.c.
void mutt_unget_string | ( | const char * | s | ) |
Return a string to the input buffer.
s | String to return |
This puts events into the UngetKeyEvents
buffer
Definition at line 544 of file curs_lib.c.
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.
[in] | src | String to measure |
[in] | maxlen | Maximum length of string in bytes |
[in] | maxwid | Maximum width in screen columns |
[out] | width | Save the truncated screen column width |
num | Bytes to use |
See how many bytes to copy from string so it's at most maxlen bytes long and maxwid columns wide
Definition at line 861 of file curs_lib.c.
|
extern |
Timeout in ms for mutt_getch()
Timeout in ms for mutt_getch()
Definition at line 125 of file curs_lib.c.