NeoMutt  2020-06-26-89-g172cd3
Teaching an old dog new tricks
DOXYGEN
curs_lib.c File Reference

GUI miscellaneous curses (window drawing) routines. More...

#include "config.h"
#include <stddef.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <langinfo.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "mutt.h"
#include "curs_lib.h"
#include "browser.h"
#include "color.h"
#include "enter_state.h"
#include "keymap.h"
#include "mutt_curses.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt_window.h"
#include "opcodes.h"
#include "options.h"
#include "pager.h"
#include "protos.h"
#include "monitor.h"
+ Include dependency graph for curs_lib.c:

Go to the source code of this file.

Functions

void mutt_beep (bool force)
 Irritate the user. More...
 
void mutt_refresh (void)
 Force a refresh of the screen. More...
 
void mutt_need_hard_redraw (void)
 Force a hard refresh. More...
 
void mutt_getch_timeout (int delay)
 Set the getch() timeout. More...
 
static int mutt_monitor_getch (void)
 Get a character and poll the filesystem monitor. More...
 
struct KeyEvent mutt_getch (void)
 Read a character from the input buffer. More...
 
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. More...
 
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. More...
 
int mutt_get_field_unbuffered (const char *msg, char *buf, size_t buflen, CompletionFlags flags)
 Ask the user for a string (ignoring macro buffer) More...
 
void mutt_edit_file (const char *editor, const char *file)
 Let the user edit a file. More...
 
enum QuadOption mutt_yesorno (const char *msg, enum QuadOption def)
 Ask the user a Yes/No question. More...
 
enum QuadOption query_quadoption (enum QuadOption opt, const char *prompt)
 Ask the user a quad-question. More...
 
void mutt_query_exit (void)
 Ask the user if they want to leave NeoMutt. More...
 
void mutt_show_error (void)
 Show the user an error message. More...
 
void mutt_endwin (void)
 Shutdown curses/slang. More...
 
void mutt_perror_debug (const char *s)
 Show the user an 'errno' message. More...
 
int mutt_any_key_to_continue (const char *s)
 Prompt the user to 'press any key' and wait. More...
 
static int mutt_dlg_dopager_observer (struct NotifyCallback *nc)
 Listen for config changes affecting the dopager menus - Implements observer_t. More...
 
int mutt_do_pager (const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info)
 Display some page-able text to the user. More...
 
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. More...
 
void mutt_unget_event (int ch, int op)
 Return a keystroke to the input buffer. More...
 
void mutt_unget_string (const char *s)
 Return a string to the input buffer. More...
 
void mutt_push_macro_event (int ch, int op)
 Add the character/operation to the macro buffer. 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_flushinp (void)
 Empty all the keyboard buffers. More...
 
int mutt_multi_choice (const char *prompt, const char *letters)
 Offer the user a multiple choice question. More...
 
int mutt_addwch (wchar_t wc)
 addwch would be provided by an up-to-date curses library 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...
 
void mutt_format_s_x (char *buf, size_t buflen, const char *prec, const char *s, bool arboreal)
 Format a string like snprintf() 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_paddstr (int n, const char *s)
 Display a string on screen, padded if necessary. 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...
 
int mutt_strwidth (const char *s)
 Measure a string's width in screen cells. More...
 
int mutt_strnwidth (const char *s, size_t n)
 Measure a string's width in screen cells. More...
 

Variables

bool C_MetaKey
 Config: Interpret 'ALT-x' as 'ESC-x'. More...
 
static size_t MacroBufferCount = 0
 
static size_t MacroBufferLen = 0
 
static struct KeyEventMacroEvents
 
static size_t UngetCount = 0
 
static size_t UngetLen = 0
 
static struct KeyEventUngetKeyEvents
 
int MuttGetchTimeout = -1
 Timeout in ms for mutt_getch() More...
 

Detailed Description

GUI miscellaneous curses (window drawing) routines.

Authors
  • Michael R. Elkins
  • g10 Code GmbH

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.c.

Function Documentation

◆ mutt_beep()

void mutt_beep ( bool  force)

Irritate the user.

Parameters
forceIf true, ignore the "$beep" config variable

Definition at line 97 of file curs_lib.c.

98 {
99  if (force || C_Beep)
100  beep();
101 }
WHERE bool C_Beep
Config: Make a noise when an error occurs.
Definition: mutt_globals.h:142
+ Here is the caller graph for this function:

◆ mutt_refresh()

void mutt_refresh ( void  )

Force a refresh of the screen.

Definition at line 106 of file curs_lib.c.

107 {
108  /* don't refresh when we are waiting for a child. */
109  if (OptKeepQuiet)
110  return;
111 
112  /* don't refresh in the middle of macros unless necessary */
114  return;
115 
116  /* else */
117  refresh();
118 }
static size_t MacroBufferCount
Definition: curs_lib.c:80
WHERE bool OptIgnoreMacroEvents
(pseudo) don&#39;t process macro/push/exec events while set
Definition: options.h:38
WHERE bool OptForceRefresh
(pseudo) refresh even during macros
Definition: options.h:37
WHERE bool OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program ...
Definition: options.h:39
+ Here is the caller graph for this function:

◆ mutt_need_hard_redraw()

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 128 of file curs_lib.c.

129 {
130  keypad(stdscr, true);
131  clearok(stdscr, true);
133 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_getch_timeout()

void mutt_getch_timeout ( int  delay)

Set the getch() timeout.

Parameters
delayTimeout delay in ms

delay is just like for timeout() or poll(): the number of milliseconds mutt_getch() should block for input.

  • delay == 0 means mutt_getch() is non-blocking.
  • delay < 0 means mutt_getch is blocking.

Definition at line 144 of file curs_lib.c.

145 {
146  MuttGetchTimeout = delay;
147  timeout(delay);
148 }
int MuttGetchTimeout
Timeout in ms for mutt_getch()
Definition: curs_lib.c:91
+ Here is the caller graph for this function:

◆ mutt_monitor_getch()

static int mutt_monitor_getch ( void  )
static

Get a character and poll the filesystem monitor.

Return values
numCharacter pressed
ERRTimeout

Definition at line 156 of file curs_lib.c.

157 {
158  /* ncurses has its own internal buffer, so before we perform a poll,
159  * we need to make sure there isn't a character waiting */
160  timeout(0);
161  int ch = getch();
162  timeout(MuttGetchTimeout);
163  if (ch == ERR)
164  {
165  if (mutt_monitor_poll() != 0)
166  ch = ERR;
167  else
168  ch = getch();
169  }
170  return ch;
171 }
int mutt_monitor_poll(void)
Check for filesystem changes.
Definition: monitor.c:397
int MuttGetchTimeout
Timeout in ms for mutt_getch()
Definition: curs_lib.c:91
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_getch()

struct KeyEvent mutt_getch ( void  )

Read a character from the input buffer.

Return values
objKeyEvent to process

The priority for reading events is:

  1. UngetKeyEvents buffer
  2. MacroEvents buffer
  3. Keyboard

This function can return:

  • Error { -1, OP_NULL }
  • Timeout { -2, OP_NULL }

Definition at line 187 of file curs_lib.c.

188 {
189  int ch;
190  struct KeyEvent err = { -1, OP_NULL }, ret;
191  struct KeyEvent timeout = { -2, OP_NULL };
192 
193  if (UngetCount)
194  return UngetKeyEvents[--UngetCount];
195 
197  return MacroEvents[--MacroBufferCount];
198 
199  SigInt = 0;
200 
202 #ifdef KEY_RESIZE
203  /* ncurses 4.2 sends this when the screen is resized */
204  ch = KEY_RESIZE;
205  while (ch == KEY_RESIZE)
206 #endif /* KEY_RESIZE */
207 #ifdef USE_INOTIFY
208  ch = mutt_monitor_getch();
209 #else
210  ch = getch();
211 #endif /* USE_INOTIFY */
213 
214  if (SigInt)
215  {
216  mutt_query_exit();
217  return err;
218  }
219 
220  /* either timeout, a sigwinch (if timeout is set), or the terminal
221  * has been lost */
222  if (ch == ERR)
223  {
224  if (!isatty(0))
225  mutt_exit(1);
226 
227  return timeout;
228  }
229 
230  if ((ch & 0x80) && C_MetaKey)
231  {
232  /* send ALT-x as ESC-x */
233  ch &= ~0x80;
234  mutt_unget_event(ch, 0);
235  ret.ch = '\033'; // Escape
236  ret.op = 0;
237  return ret;
238  }
239 
240  ret.ch = ch;
241  ret.op = 0;
242  return (ch == AbortKey) ? err : ret;
243 }
static struct KeyEvent * MacroEvents
Definition: curs_lib.c:82
WHERE SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
Definition: mutt_globals.h:75
static size_t MacroBufferCount
Definition: curs_lib.c:80
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:831
int ch
raw key pressed
Definition: keymap.h:63
WHERE bool OptIgnoreMacroEvents
(pseudo) don&#39;t process macro/push/exec events while set
Definition: options.h:38
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
Definition: curs_lib.c:537
void mutt_sig_allow_interrupt(bool allow)
Allow/disallow Ctrl-C (SIGINT)
Definition: signal.c:238
static size_t UngetCount
Definition: curs_lib.c:87
static struct KeyEvent * UngetKeyEvents
Definition: curs_lib.c:89
static int mutt_monitor_getch(void)
Get a character and poll the filesystem monitor.
Definition: curs_lib.c:156
An event such as a keypress.
Definition: keymap.h:61
keycode_t AbortKey
code of key to abort prompts, normally Ctrl-G
Definition: keymap.c:147
void mutt_exit(int code)
Leave NeoMutt NOW.
Definition: main.c:137
bool C_MetaKey
Config: Interpret &#39;ALT-x&#39; as &#39;ESC-x&#39;.
Definition: curs_lib.c:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_buffer_get_field_full()

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.

Parameters
[in]fieldPrompt
[in]bufBuffer for the result
[in]completeFlags, see CompletionFlags
[in]multipleAllow multiple selections
[out]filesList of files selected
[out]numfilesNumber of files selected
Return values
1Redraw the screen and call the function again
0Selection made
-1Aborted

Definition at line 257 of file curs_lib.c.

259 {
260  int ret;
261  int col;
262 
263  struct EnterState *es = mutt_enter_state_new();
264 
265  do
266  {
267  if (SigWinch)
268  {
269  SigWinch = 0;
271  clearok(stdscr, true);
273  }
276  mutt_window_addstr(field);
278  mutt_refresh();
280  ret = mutt_enter_string_full(buf->data, buf->dsize, col, complete, multiple,
281  files, numfiles, es);
282  } while (ret == 1);
283 
284  if (ret == 0)
286  else
287  mutt_buffer_reset(buf);
288 
291 
292  return ret;
293 }
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:101
int mutt_enter_string_full(char *buf, size_t buflen, int col, CompletionFlags flags, bool multiple, char ***files, int *numfiles, struct EnterState *state)
Ask the user for a string.
Definition: enter.c:177
size_t dsize
Length of data.
Definition: buffer.h:37
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
void mutt_buffer_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition: buffer.c:181
Plain text.
Definition: color.h:77
Keep our place when entering a string.
Definition: enter_state.h:32
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
Definition: mutt_window.c:302
void mutt_enter_state_free(struct EnterState **ptr)
Free an EnterState.
Definition: enter.c:832
char * data
Pointer to data.
Definition: buffer.h:35
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
struct EnterState * mutt_enter_state_new(void)
Create a new EnterState.
Definition: enter.c:126
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: mutt_globals.h:76
Question/user input.
Definition: color.h:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_get_field_full()

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.

Parameters
[in]fieldPrompt
[in]bufBuffer for the result
[in]buflenLength of buffer
[in]completeFlags, see CompletionFlags
[in]multipleAllow multiple selections
[out]filesList of files selected
[out]numfilesNumber of files selected
Return values
1Redraw the screen and call the function again
0Selection made
-1Aborted

Definition at line 308 of file curs_lib.c.

310 {
311  if (!buf)
312  return -1;
313 
314  struct Buffer tmp = {
315  .data = buf,
316  .dptr = buf + mutt_str_len(buf),
317  .dsize = buflen,
318  };
319  return mutt_buffer_get_field_full(field, &tmp, complete, multiple, files, numfiles);
320 }
String manipulation buffer.
Definition: buffer.h:33
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
char * data
Pointer to data.
Definition: buffer.h:35
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
+ Here is the call graph for this function:

◆ mutt_get_field_unbuffered()

int mutt_get_field_unbuffered ( const char *  msg,
char *  buf,
size_t  buflen,
CompletionFlags  flags 
)

Ask the user for a string (ignoring macro buffer)

Parameters
msgPrompt
bufBuffer for the result
buflenLength of buffer
flagsFlags, see CompletionFlags
Return values
1Redraw the screen and call the function again
0Selection made
-1Aborted

Definition at line 332 of file curs_lib.c.

333 {
334  bool reset_ignoremacro = false;
335 
337  {
338  OptIgnoreMacroEvents = true;
339  reset_ignoremacro = true;
340  }
341  int rc = mutt_get_field(msg, buf, buflen, flags);
342  if (reset_ignoremacro)
343  OptIgnoreMacroEvents = false;
344 
345  return rc;
346 }
WHERE bool OptIgnoreMacroEvents
(pseudo) don&#39;t process macro/push/exec events while set
Definition: options.h:38
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:91
+ Here is the caller graph for this function:

◆ mutt_edit_file()

void mutt_edit_file ( const char *  editor,
const char *  file 
)

Let the user edit a file.

Parameters
editorUser's editor config
fileFile to edit

Definition at line 353 of file curs_lib.c.

354 {
355  struct Buffer *cmd = mutt_buffer_pool_get();
356 
357  mutt_endwin();
359  if (mutt_system(mutt_b2s(cmd)) != 0)
360  {
361  mutt_error(_("Error running \"%s\""), mutt_b2s(cmd));
362  }
363  /* the terminal may have been resized while the editor owned it */
365  keypad(stdscr, true);
366  clearok(stdscr, true);
367 
369 }
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:101
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
#define mutt_b2s(buf)
Definition: buffer.h:41
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:569
#define mutt_error(...)
Definition: logging.h:84
void mutt_buffer_file_expand_fmt_quote(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
Definition: file.c:1425
int const char * file
Definition: acutest.h:617
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_yesorno()

enum QuadOption mutt_yesorno ( const char *  msg,
enum QuadOption  def 
)

Ask the user a Yes/No question.

Parameters
msgPrompt
defDefault answer, MUTT_YES or MUTT_NO (see QuadOption)
Return values
numSelection made, see QuadOption

Definition at line 377 of file curs_lib.c.

378 {
379  struct KeyEvent ch;
380  char *yes = _("yes");
381  char *no = _("no");
382  char *answer_string = NULL;
383  int answer_string_wid, msg_wid;
384  size_t trunc_msg_len;
385  bool redraw = true;
386  int prompt_lines = 1;
387 
388  char *expr = NULL;
389  regex_t reyes;
390  regex_t reno;
391  char answer[2];
392 
393  answer[1] = '\0';
394 
395  bool reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] == '^') &&
396  (REG_COMP(&reyes, expr, REG_NOSUB) == 0);
397  bool reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] == '^') &&
398  (REG_COMP(&reno, expr, REG_NOSUB) == 0);
399 
400  /* In order to prevent the default answer to the question to wrapped
401  * around the screen in the even the question is wider than the screen,
402  * ensure there is enough room for the answer and truncate the question
403  * to fit. */
404  mutt_str_asprintf(&answer_string, " ([%s]/%s): ", (def == MUTT_YES) ? yes : no,
405  (def == MUTT_YES) ? no : yes);
406  answer_string_wid = mutt_strwidth(answer_string);
407  msg_wid = mutt_strwidth(msg);
408 
409  while (true)
410  {
411  if (redraw || SigWinch)
412  {
413  redraw = false;
414  if (SigWinch)
415  {
416  SigWinch = 0;
418  clearok(stdscr, true);
420  }
422  {
423  prompt_lines = (msg_wid + answer_string_wid + MuttMessageWindow->state.cols - 1) /
425  prompt_lines = MAX(1, MIN(3, prompt_lines));
426  }
427  if (prompt_lines != MuttMessageWindow->state.rows)
428  {
429  mutt_window_reflow_message_rows(prompt_lines);
431  }
432 
433  /* maxlen here is sort of arbitrary, so pick a reasonable upper bound */
434  trunc_msg_len = mutt_wstr_trunc(
435  msg, (size_t) 4 * prompt_lines * MuttMessageWindow->state.cols,
436  ((size_t) prompt_lines * MuttMessageWindow->state.cols) - answer_string_wid, NULL);
437 
440  mutt_window_addnstr(msg, trunc_msg_len);
441  mutt_window_addstr(answer_string);
444  }
445 
446  mutt_refresh();
447  /* SigWinch is not processed unless timeout is set */
448  mutt_getch_timeout(30 * 1000);
449  ch = mutt_getch();
450  mutt_getch_timeout(-1);
451  if (ch.ch == -2)
452  continue;
453  if (CI_is_return(ch.ch))
454  break;
455  if (ch.ch < 0)
456  {
457  def = MUTT_ABORT;
458  break;
459  }
460 
461  answer[0] = ch.ch;
462  if (reyes_ok ? (regexec(&reyes, answer, 0, 0, 0) == 0) : (tolower(ch.ch) == 'y'))
463  {
464  def = MUTT_YES;
465  break;
466  }
467  else if (reno_ok ? (regexec(&reno, answer, 0, 0, 0) == 0) : (tolower(ch.ch) == 'n'))
468  {
469  def = MUTT_NO;
470  break;
471  }
472  else
473  {
474  mutt_beep(false);
475  }
476  }
477 
478  FREE(&answer_string);
479 
480  if (reyes_ok)
481  regfree(&reyes);
482  if (reno_ok)
483  regfree(&reno);
484 
485  if (MuttMessageWindow->state.rows == 1)
486  {
488  }
489  else
490  {
493  }
494 
495  if (def == MUTT_ABORT)
496  {
497  /* when the users cancels with ^G, clear the message stored with
498  * mutt_message() so it isn't displayed when the screen is refreshed. */
500  }
501  else
502  {
503  mutt_window_addstr((char *) ((def == MUTT_YES) ? yes : no));
504  mutt_refresh();
505  }
506  return def;
507 }
#define CI_is_return(ch)
Definition: mutt_curses.h:71
#define MIN(a, b)
Definition: memory.h:31
User aborted the question (with Ctrl-G)
Definition: quad.h:38
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:216
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:101
#define _(a)
Definition: message.h:28
int ch
raw key pressed
Definition: keymap.h:63
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
void mutt_beep(bool force)
Irritate the user.
Definition: curs_lib.c:97
#define MAX(a, b)
Definition: memory.h:30
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:500
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition: regex3.h:53
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
Plain text.
Definition: color.h:77
void mutt_window_reflow_message_rows(int mw_rows)
Resize the Message Window.
Definition: mutt_window.c:455
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:119
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1356
User answered &#39;No&#39;, or assume &#39;No&#39;.
Definition: quad.h:39
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
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:1306
An event such as a keypress.
Definition: keymap.h:61
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
void mutt_getch_timeout(int delay)
Set the getch() timeout.
Definition: curs_lib.c:144
#define FREE(x)
Definition: memory.h:40
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
int mutt_str_asprintf(char **strp, const char *fmt,...)
Definition: string.c:1100
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: mutt_globals.h:76
Question/user input.
Definition: color.h:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_quadoption()

enum QuadOption query_quadoption ( enum QuadOption  opt,
const char *  prompt 
)

Ask the user a quad-question.

Parameters
optOption to use
promptMessage to show to the user
Return values
QuadOptionResult, e.g. MUTT_NO

Definition at line 515 of file curs_lib.c.

516 {
517  switch (opt)
518  {
519  case MUTT_YES:
520  case MUTT_NO:
521  return opt;
522 
523  default:
524  opt = mutt_yesorno(prompt, (opt == MUTT_ASKYES) ? MUTT_YES : MUTT_NO);
526  return opt;
527  }
528 
529  /* not reached */
530 }
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
Ask the user, defaulting to &#39;Yes&#39;.
Definition: quad.h:42
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:377
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
User answered &#39;No&#39;, or assume &#39;No&#39;.
Definition: quad.h:39
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_query_exit()

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 537 of file curs_lib.c.

538 {
539  mutt_flushinp();
541  if (C_Timeout)
542  mutt_getch_timeout(-1); /* restore blocking operation */
543  if (mutt_yesorno(_("Exit NeoMutt?"), MUTT_YES) == MUTT_YES)
544  {
545  mutt_exit(1);
546  }
549  SigInt = 0;
550 }
WHERE short C_Timeout
Config: Time to wait for user input in menus.
Definition: mutt_globals.h:118
WHERE SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
Definition: mutt_globals.h:75
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:916
#define _(a)
Definition: message.h:28
void mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition: mutt_curses.c:76
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:377
Display a normal cursor.
Definition: mutt_curses.h:81
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
Restore the previous cursor state.
Definition: mutt_curses.h:79
void mutt_exit(int code)
Leave NeoMutt NOW.
Definition: main.c:137
void mutt_getch_timeout(int delay)
Set the getch() timeout.
Definition: curs_lib.c:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_show_error()

void mutt_show_error ( void  )

Show the user an error message.

Definition at line 555 of file curs_lib.c.

556 {
558  return;
559 
564 }
Informational message.
Definition: color.h:75
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:216
WHERE char ErrorBuf[256]
Copy of the last error message.
Definition: mutt_globals.h:46
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:376
Plain text.
Definition: color.h:77
Error message.
Definition: color.h:70
WHERE bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
Definition: options.h:41
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
WHERE bool ErrorBufMessage
true if the last message was an error
Definition: mutt_globals.h:45
WHERE bool OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program ...
Definition: options.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_endwin()

void mutt_endwin ( void  )

Shutdown curses/slang.

Definition at line 569 of file curs_lib.c.

570 {
571  if (OptNoCurses)
572  return;
573 
574  int e = errno;
575 
576  /* at least in some situations (screen + xterm under SuSE11/12) endwin()
577  * doesn't properly flush the screen without an explicit call. */
578  mutt_refresh();
579  endwin();
580 
581  errno = e;
582 }
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:48
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_perror_debug()

void mutt_perror_debug ( const char *  s)

Show the user an 'errno' message.

Parameters
sAdditional text to show

Definition at line 588 of file curs_lib.c.

589 {
590  char *p = strerror(errno);
591 
592  mutt_debug(LL_DEBUG1, "%s: %s (errno = %d)\n", s, p ? p : "unknown error", errno);
593  mutt_error("%s: %s (errno = %d)", s, p ? p : _("unknown error"), errno);
594 }
#define _(a)
Definition: message.h:28
Log at debug level 1.
Definition: logging.h:40
#define mutt_error(...)
Definition: logging.h:84
#define mutt_debug(LEVEL,...)
Definition: logging.h:81

◆ mutt_any_key_to_continue()

int mutt_any_key_to_continue ( const char *  s)

Prompt the user to 'press any key' and wait.

Parameters
sMessage prompt
Return values
numKey pressed
EOFError, or prompt aborted

Definition at line 602 of file curs_lib.c.

603 {
604  struct termios term;
605  struct termios old;
606 
607  int fd = open("/dev/tty", O_RDONLY);
608  if (fd < 0)
609  return EOF;
610 
611  tcgetattr(fd, &old); // Save the current tty settings
612 
613  term = old;
614  term.c_lflag &= ~(ICANON | ECHO); // Canonical (not line-buffered), don't echo the characters
615  term.c_cc[VMIN] = 1; // Wait for at least one character
616  term.c_cc[VTIME] = 255; // Wait for 25.5s
617  tcsetattr(fd, TCSANOW, &term);
618 
619  if (s)
620  fputs(s, stdout);
621  else
622  fputs(_("Press any key to continue..."), stdout);
623  fflush(stdout);
624 
625  char ch = '\0';
626  // Wait for a character. This might timeout, so loop.
627  while (read(fd, &ch, 1) == 0)
628  ; // do nothing
629 
630  // Change the tty settings to be non-blocking
631  term.c_cc[VMIN] = 0; // Returning with zero characters is acceptable
632  term.c_cc[VTIME] = 0; // Don't wait
633  tcsetattr(fd, TCSANOW, &term);
634 
635  char buf[64];
636  while (read(fd, buf, sizeof(buf)) > 0)
637  ; // Mop up any remaining chars
638 
639  tcsetattr(fd, TCSANOW, &old); // Restore the previous tty settings
640  close(fd);
641 
642  fputs("\r\n", stdout);
644  return (ch >= 0) ? ch : EOF;
645 }
#define _(a)
Definition: message.h:28
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_dlg_dopager_observer()

static int mutt_dlg_dopager_observer ( struct NotifyCallback nc)
static

Listen for config changes affecting the dopager menus - Implements observer_t.

Definition at line 650 of file curs_lib.c.

651 {
652  if (!nc->event_data || !nc->global_data)
653  return -1;
654  if (nc->event_type != NT_CONFIG)
655  return 0;
656 
657  struct EventConfig *ec = nc->event_data;
658  struct MuttWindow *dlg = nc->global_data;
659 
660  if (!mutt_str_equal(ec->name, "status_on_top"))
661  return 0;
662 
663  struct MuttWindow *win_first = TAILQ_FIRST(&dlg->children);
664  if (!win_first)
665  return -1;
666 
667  if ((C_StatusOnTop && (win_first->type == WT_PAGER)) ||
668  (!C_StatusOnTop && (win_first->type != WT_PAGER)))
669  {
670  // Swap the Index and the IndexBar Windows
671  TAILQ_REMOVE(&dlg->children, win_first, entries);
672  TAILQ_INSERT_TAIL(&dlg->children, win_first, entries);
673  }
674 
675  mutt_window_reflow(dlg);
676  return 0;
677 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:876
#define TAILQ_FIRST(head)
Definition: queue.h:716
A config-change event.
Definition: subset.h:70
A division of the screen.
Definition: mutt_window.h:114
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:41
void * global_data
Data from notify_observer_add()
Definition: observer.h:44
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:802
void * event_data
Data from notify_send()
Definition: observer.h:43
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:36
Window containing paged free-form text.
Definition: mutt_window.h:96
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:429
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: mutt_globals.h:166
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:128
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:132
const char * name
Name of config item that changed.
Definition: subset.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_do_pager()

int mutt_do_pager ( const char *  banner,
const char *  tempfile,
PagerFlags  do_color,
struct Pager info 
)

Display some page-able text to the user.

Parameters
bannerMessage for status bar
tempfileFile to display
do_colorFlags, see PagerFlags
infoInfo about current mailbox (OPTIONAL)
Return values
0Success
-1Error

Definition at line 688 of file curs_lib.c.

690 {
691  struct Pager info2 = { 0 };
692  if (!info)
693  info = &info2;
694 
695  struct MuttWindow *dlg =
698 
699  struct MuttWindow *pager =
702 
703  struct MuttWindow *pbar =
706 
707  if (C_StatusOnTop)
708  {
709  mutt_window_add_child(dlg, pbar);
710  mutt_window_add_child(dlg, pager);
711  }
712  else
713  {
714  mutt_window_add_child(dlg, pager);
715  mutt_window_add_child(dlg, pbar);
716  }
717 
719  dialog_push(dlg);
720 
721  info->win_ibar = NULL;
722  info->win_index = NULL;
723  info->win_pbar = pbar;
724  info->win_pager = pager;
725 
726  int rc;
727 
728  if (!C_Pager || mutt_str_equal(C_Pager, "builtin"))
729  rc = mutt_pager(banner, tempfile, do_color, info);
730  else
731  {
732  struct Buffer *cmd = mutt_buffer_pool_get();
733 
734  mutt_endwin();
736  if (mutt_system(mutt_b2s(cmd)) == -1)
737  {
738  mutt_error(_("Error running \"%s\""), mutt_b2s(cmd));
739  rc = -1;
740  }
741  else
742  rc = 0;
743  mutt_file_unlink(tempfile);
745  }
746 
747  dialog_pop();
749  mutt_window_free(&dlg);
750  return rc;
751 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:876
struct MuttWindow * win_index
Definition: pager.h:74
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
Pager Bar containing status info about the Pager.
Definition: mutt_window.h:97
Window uses all available vertical space.
Definition: mutt_window.h:35
void dialog_pop(void)
Hide a Window from the user.
Definition: mutt_window.c:750
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: mutt_window.c:720
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:195
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
A division of the screen.
Definition: mutt_window.h:114
An email being displayed.
Definition: pager.h:65
Container for Accounts, Notifications.
Definition: neomutt.h:36
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:151
static int mutt_dlg_dopager_observer(struct NotifyCallback *nc)
Listen for config changes affecting the dopager menus - Implements observer_t.
Definition: curs_lib.c:650
Window has a fixed size.
Definition: mutt_window.h:44
struct MuttWindow * win_pager
Definition: pager.h:76
#define mutt_b2s(buf)
Definition: buffer.h:41
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:569
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:49
Pager Dialog, mutt_do_pager()
Definition: mutt_window.h:81
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
bool notify_observer_add(struct Notify *notify, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:153
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:561
Window containing paged free-form text.
Definition: mutt_window.h:96
WHERE char * C_Pager
Config: External command for viewing messages, or &#39;builtin&#39; to use NeoMutt&#39;s.
Definition: mutt_globals.h:102
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: mutt_globals.h:166
#define mutt_error(...)
Definition: logging.h:84
void mutt_buffer_file_expand_fmt_quote(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
Definition: file.c:1425
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:185
struct MuttWindow * win_ibar
Definition: pager.h:73
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
Definition: mutt_window.c:131
int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct Pager *extra)
Display a file, or help, in a window.
Definition: pager.c:2204
Window wants as much space as possible.
Definition: mutt_window.h:45
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:51
struct MuttWindow * win_pbar
Definition: pager.h:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_buffer_enter_fname_full()

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.

Parameters
[in]promptPrompt
[in]fnameBuffer for the result
[in]mailboxIf true, select mailboxes
[in]multipleAllow multiple selections
[out]filesList of files selected
[out]numfilesNumber of files selected
[in]flagsFlags, see SelectFileFlags
Return values
0Success
-1Error

Definition at line 765 of file curs_lib.c.

768 {
769  struct KeyEvent ch;
770 
773  mutt_window_addstr(_(" ('?' for list): "));
775  if (!mutt_buffer_is_empty(fname))
778  mutt_refresh();
779 
780  do
781  {
782  ch = mutt_getch();
783  } while (ch.ch == -2);
784  if (ch.ch < 0)
785  {
787  return -1;
788  }
789  else if (ch.ch == '?')
790  {
791  mutt_refresh();
792  mutt_buffer_reset(fname);
793 
794  if (flags == MUTT_SEL_NO_FLAGS)
795  flags = MUTT_SEL_FOLDER;
796  if (multiple)
797  flags |= MUTT_SEL_MULTI;
798  if (mailbox)
799  flags |= MUTT_SEL_MAILBOX;
800  mutt_buffer_select_file(fname, flags, files, numfiles);
801  }
802  else
803  {
804  char *pc = mutt_mem_malloc(mutt_str_len(prompt) + 3);
805 
806  sprintf(pc, "%s: ", prompt);
807  if (ch.op == OP_NULL)
808  mutt_unget_event(ch.ch, 0);
809  else
810  mutt_unget_event(0, ch.op);
811 
812  mutt_buffer_alloc(fname, 1024);
813  if (mutt_buffer_get_field_full(pc, fname, (mailbox ? MUTT_EFILE : MUTT_FILE) | MUTT_CLEAR,
814  multiple, files, numfiles) != 0)
815  {
816  mutt_buffer_reset(fname);
817  }
818  FREE(&pc);
819  }
820 
821  return 0;
822 }
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
#define MUTT_CLEAR
Clear input if printable character is pressed.
Definition: mutt.h:62
void mutt_buffer_select_file(struct Buffer *file, SelectFileFlags flags, char ***files, int *numfiles)
Let the user select a file.
Definition: browser.c:1182
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:216
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:831
#define _(a)
Definition: message.h:28
int ch
raw key pressed
Definition: keymap.h:63
#define MUTT_SEL_NO_FLAGS
No flags are set.
Definition: browser.h:44
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:376
#define MUTT_SEL_FOLDER
Select a local directory.
Definition: browser.h:47
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
Plain text.
Definition: color.h:77
#define mutt_b2s(buf)
Definition: buffer.h:41
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
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
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
An event such as a keypress.
Definition: keymap.h:61
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: browser.h:46
#define MUTT_FILE
Do file completion.
Definition: mutt.h:58
#define MUTT_SEL_MAILBOX
Select a mailbox.
Definition: browser.h:45
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
#define MUTT_EFILE
Do file completion, plus incoming folders.
Definition: mutt.h:59
#define FREE(x)
Definition: memory.h:40
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
Question/user input.
Definition: color.h:80
void mutt_buffer_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition: buffer.c:265
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_unget_event()

void mutt_unget_event ( int  ch,
int  op 
)

Return a keystroke to the input buffer.

Parameters
chKey press
opOperation, e.g. OP_DELETE

This puts events into the UngetKeyEvents buffer

Definition at line 831 of file curs_lib.c.

832 {
833  struct KeyEvent tmp;
834 
835  tmp.ch = ch;
836  tmp.op = op;
837 
838  if (UngetCount >= UngetLen)
839  mutt_mem_realloc(&UngetKeyEvents, (UngetLen += 16) * sizeof(struct KeyEvent));
840 
841  UngetKeyEvents[UngetCount++] = tmp;
842 }
int op
function op
Definition: keymap.h:64
int ch
raw key pressed
Definition: keymap.h:63
static size_t UngetCount
Definition: curs_lib.c:87
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
static struct KeyEvent * UngetKeyEvents
Definition: curs_lib.c:89
An event such as a keypress.
Definition: keymap.h:61
static size_t UngetLen
Definition: curs_lib.c:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_unget_string()

void mutt_unget_string ( const char *  s)

Return a string to the input buffer.

Parameters
sString to return

This puts events into the UngetKeyEvents buffer

Definition at line 850 of file curs_lib.c.

851 {
852  const char *p = s + mutt_str_len(s) - 1;
853 
854  while (p >= s)
855  {
856  mutt_unget_event((unsigned char) *p--, 0);
857  }
858 }
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:831
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_push_macro_event()

void mutt_push_macro_event ( int  ch,
int  op 
)

Add the character/operation to the macro buffer.

Parameters
chCharacter to add
opOperation to add

Adds the ch/op to the macro buffer. This should be used for macros, push, and exec commands only.

Definition at line 868 of file curs_lib.c.

869 {
870  struct KeyEvent tmp;
871 
872  tmp.ch = ch;
873  tmp.op = op;
874 
876  mutt_mem_realloc(&MacroEvents, (MacroBufferLen += 128) * sizeof(struct KeyEvent));
877 
878  MacroEvents[MacroBufferCount++] = tmp;
879 }
static struct KeyEvent * MacroEvents
Definition: curs_lib.c:82
static size_t MacroBufferCount
Definition: curs_lib.c:80
int op
function op
Definition: keymap.h:64
int ch
raw key pressed
Definition: keymap.h:63
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
An event such as a keypress.
Definition: keymap.h:61
static size_t MacroBufferLen
Definition: curs_lib.c:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_flush_macro_to_endcond()

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 887 of file curs_lib.c.

888 {
889  UngetCount = 0;
890  while (MacroBufferCount > 0)
891  {
892  if (MacroEvents[--MacroBufferCount].op == OP_END_COND)
893  return;
894  }
895 }
static struct KeyEvent * MacroEvents
Definition: curs_lib.c:82
static size_t MacroBufferCount
Definition: curs_lib.c:80
int op
function op
Definition: keymap.h:64
static size_t UngetCount
Definition: curs_lib.c:87
+ Here is the caller graph for this function:

◆ mutt_flush_unget_to_endcond()

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 904 of file curs_lib.c.

905 {
906  while (UngetCount > 0)
907  {
908  if (UngetKeyEvents[--UngetCount].op == OP_END_COND)
909  return;
910  }
911 }
int op
function op
Definition: keymap.h:64
static size_t UngetCount
Definition: curs_lib.c:87
static struct KeyEvent * UngetKeyEvents
Definition: curs_lib.c:89
+ Here is the caller graph for this function:

◆ mutt_flushinp()

void mutt_flushinp ( void  )

Empty all the keyboard buffers.

Definition at line 916 of file curs_lib.c.

917 {
918  UngetCount = 0;
919  MacroBufferCount = 0;
920  flushinp();
921 }
static size_t MacroBufferCount
Definition: curs_lib.c:80
static size_t UngetCount
Definition: curs_lib.c:87
+ Here is the caller graph for this function:

◆ mutt_multi_choice()

int mutt_multi_choice ( const char *  prompt,
const char *  letters 
)

Offer the user a multiple choice question.

Parameters
promptMessage prompt
lettersAllowable selection keys
Return values
>=00-based user selection
-1Selection aborted

Definition at line 930 of file curs_lib.c.

931 {
932  struct KeyEvent ch;
933  int choice;
934  bool redraw = true;
935  int prompt_lines = 1;
936 
937  bool opt_cols = ((Colors->defs[MT_COLOR_OPTIONS] != 0) &&
939 
940  while (true)
941  {
942  if (redraw || SigWinch)
943  {
944  redraw = false;
945  if (SigWinch)
946  {
947  SigWinch = 0;
949  clearok(stdscr, true);
951  }
953  {
954  int width = mutt_strwidth(prompt) + 2; // + '?' + space
955  /* If we're going to colour the options,
956  * make an assumption about the modified prompt size. */
957  if (opt_cols)
958  width -= 2 * mutt_str_len(letters);
959 
960  prompt_lines = (width + MuttMessageWindow->state.cols - 1) /
962  prompt_lines = MAX(1, MIN(3, prompt_lines));
963  }
964  if (prompt_lines != MuttMessageWindow->state.rows)
965  {
966  mutt_window_reflow_message_rows(prompt_lines);
968  }
969 
971 
972  if ((Colors->defs[MT_COLOR_OPTIONS] != 0) &&
974  {
975  char *cur = NULL;
976 
977  while ((cur = strchr(prompt, '(')))
978  {
979  // write the part between prompt and cur using MT_COLOR_PROMPT
981  mutt_window_addnstr(prompt, cur - prompt);
982 
983  if (isalnum(cur[1]) && (cur[2] == ')'))
984  {
985  // we have a single letter within parentheses
987  mutt_window_addch(cur[1]);
988  prompt = cur + 3;
989  }
990  else
991  {
992  // we have a parenthesis followed by something else
993  mutt_window_addch(cur[0]);
994  prompt = cur + 1;
995  }
996  }
997  }
998 
1000  mutt_window_addstr(prompt);
1002 
1003  mutt_window_addch(' ');
1005  }
1006 
1007  mutt_refresh();
1008  /* SigWinch is not processed unless timeout is set */
1009  mutt_getch_timeout(30 * 1000);
1010  ch = mutt_getch();
1011  mutt_getch_timeout(-1);
1012  if (ch.ch == -2)
1013  continue;
1014  /* (ch.ch == 0) is technically possible. Treat the same as < 0 (abort) */
1015  if ((ch.ch <= 0) || CI_is_return(ch.ch))
1016  {
1017  choice = -1;
1018  break;
1019  }
1020  else
1021  {
1022  char *p = strchr(letters, ch.ch);
1023  if (p)
1024  {
1025  choice = p - letters + 1;
1026  break;
1027  }
1028  else if ((ch.ch <= '9') && (ch.ch > '0'))
1029  {
1030  choice = ch.ch - '0';
1031  if (choice <= mutt_str_len(letters))
1032  break;
1033  }
1034  }
1035  mutt_beep(false);
1036  }
1037  if (MuttMessageWindow->state.rows == 1)
1038  {
1040  }
1041  else
1042  {
1045  }
1046  mutt_refresh();
1047  return choice;
1048 }
#define CI_is_return(ch)
Definition: mutt_curses.h:71
#define MIN(a, b)
Definition: memory.h:31
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:131
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:216
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:101
int ch
raw key pressed
Definition: keymap.h:63
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
void mutt_beep(bool force)
Irritate the user.
Definition: curs_lib.c:97
#define MAX(a, b)
Definition: memory.h:30
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:500
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
Plain text.
Definition: color.h:77
void mutt_window_reflow_message_rows(int mw_rows)
Resize the Message Window.
Definition: mutt_window.c:455
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:119
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1356
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
An event such as a keypress.
Definition: keymap.h:61
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
Definition: color.h:129
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:488
void mutt_getch_timeout(int delay)
Set the getch() timeout.
Definition: curs_lib.c:144
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
Options in prompt.
Definition: color.h:78
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: mutt_globals.h:76
Question/user input.
Definition: color.h:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_addwch()

int mutt_addwch ( wchar_t  wc)

addwch would be provided by an up-to-date curses library

Parameters
wcWide char to display
Return values
0Success
-1Error

Definition at line 1056 of file curs_lib.c.

1057 {
1058  char buf[MB_LEN_MAX * 2];
1059  mbstate_t mbstate;
1060  size_t n1, n2;
1061 
1062  memset(&mbstate, 0, sizeof(mbstate));
1063  if (((n1 = wcrtomb(buf, wc, &mbstate)) == (size_t)(-1)) ||
1064  ((n2 = wcrtomb(buf + n1, 0, &mbstate)) == (size_t)(-1)))
1065  {
1066  return -1; /* ERR */
1067  }
1068  else
1069  {
1070  return mutt_window_addstr(buf);
1071  }
1072 }
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_simple_format()

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()

Parameters
[out]bufBuffer in which to save string
[in]buflenBuffer length
[in]min_widthMinimum width
[in]max_widthMaximum width
[in]justifyJustification, e.g. JUSTIFY_RIGHT
[in]pad_charPadding character
[in]sString to format
[in]nNumber of bytes of string to format
[in]arborealIf 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 1090 of file curs_lib.c.

1093 {
1094  wchar_t wc;
1095  int w;
1096  size_t k, k2;
1097  char scratch[MB_LEN_MAX];
1098  mbstate_t mbstate1, mbstate2;
1099  bool escaped = false;
1100 
1101  memset(&mbstate1, 0, sizeof(mbstate1));
1102  memset(&mbstate2, 0, sizeof(mbstate2));
1103  buflen--;
1104  char *p = buf;
1105  for (; n && (k = mbrtowc(&wc, s, n, &mbstate1)); s += k, n -= k)
1106  {
1107  if ((k == (size_t)(-1)) || (k == (size_t)(-2)))
1108  {
1109  if ((k == (size_t)(-1)) && (errno == EILSEQ))
1110  memset(&mbstate1, 0, sizeof(mbstate1));
1111 
1112  k = (k == (size_t)(-1)) ? 1 : n;
1113  wc = ReplacementChar;
1114  }
1115  if (escaped)
1116  {
1117  escaped = false;
1118  w = 0;
1119  }
1120  else if (arboreal && (wc == MUTT_SPECIAL_INDEX))
1121  {
1122  escaped = true;
1123  w = 0;
1124  }
1125  else if (arboreal && (wc < MUTT_TREE_MAX))
1126  {
1127  w = 1; /* hack */
1128  }
1129  else
1130  {
1131 #ifdef HAVE_ISWBLANK
1132  if (iswblank(wc))
1133  wc = ' ';
1134  else
1135 #endif
1136  if (!IsWPrint(wc))
1137  wc = '?';
1138  w = wcwidth(wc);
1139  }
1140  if (w >= 0)
1141  {
1142  if ((w > max_width) || ((k2 = wcrtomb(scratch, wc, &mbstate2)) > buflen))
1143  continue;
1144  min_width -= w;
1145  max_width -= w;
1146  strncpy(p, scratch, k2);
1147  p += k2;
1148  buflen -= k2;
1149  }
1150  }
1151  w = ((int) buflen < min_width) ? buflen : min_width;
1152  if (w <= 0)
1153  *p = '\0';
1154  else if (justify == JUSTIFY_RIGHT) /* right justify */
1155  {
1156  p[w] = '\0';
1157  while (--p >= buf)
1158  p[w] = *p;
1159  while (--w >= 0)
1160  buf[w] = pad_char;
1161  }
1162  else if (justify == JUSTIFY_CENTER) /* center */
1163  {
1164  char *savedp = p;
1165  int half = (w + 1) / 2; /* half of cushion space */
1166 
1167  p[w] = '\0';
1168 
1169  /* move str to center of buffer */
1170  while (--p >= buf)
1171  p[half] = *p;
1172 
1173  /* fill rhs */
1174  p = savedp + half;
1175  while (--w >= half)
1176  *p++ = pad_char;
1177 
1178  /* fill lhs */
1179  while (half--)
1180  buf[half] = pad_char;
1181  }
1182  else /* left justify */
1183  {
1184  while (--w >= 0)
1185  *p++ = pad_char;
1186  *p = '\0';
1187  }
1188 }
#define IsWPrint(wc)
Definition: mbyte.h:40
Right justify the text.
Definition: curs_lib.h:49
wchar_t ReplacementChar
When a Unicode character can&#39;t be displayed, use this instead.
Definition: charset.c:58
Centre the text.
Definition: curs_lib.h:48
Colour indicator.
Definition: mutt_menu.h:74
int n
Definition: acutest.h:492
#define EILSEQ
Definition: charset.c:49
+ Here is the caller graph for this function:

◆ mutt_format_s_x()

void mutt_format_s_x ( char *  buf,
size_t  buflen,
const char *  prec,
const char *  s,
bool  arboreal 
)

Format a string like snprintf()

Parameters
[out]bufBuffer in which to save string
[in]buflenBuffer length
[in]precField precision, e.g. "-3.4"
[in]sString to format
[in]arborealIf true, string contains graphical tree characters

This formats a string rather like:

  • snprintf(fmt, sizeof(fmt), "%%%ss", prec);
  • snprintf(buf, buflen, fmt, s); except that the numbers in the conversion specification refer to the number of character cells when printed.

Definition at line 1204 of file curs_lib.c.

1205 {
1206  enum FormatJustify justify = JUSTIFY_RIGHT;
1207  char *p = NULL;
1208  int min_width;
1209  int max_width = INT_MAX;
1210 
1211  if (*prec == '-')
1212  {
1213  prec++;
1214  justify = JUSTIFY_LEFT;
1215  }
1216  else if (*prec == '=')
1217  {
1218  prec++;
1219  justify = JUSTIFY_CENTER;
1220  }
1221  min_width = strtol(prec, &p, 10);
1222  if (*p == '.')
1223  {
1224  prec = p + 1;
1225  max_width = strtol(prec, &p, 10);
1226  if (p <= prec)
1227  max_width = INT_MAX;
1228  }
1229 
1230  mutt_simple_format(buf, buflen, min_width, max_width, justify, ' ', s,
1231  mutt_str_len(s), arboreal);
1232 }
Left justify the text.
Definition: curs_lib.h:47
FormatJustify
Alignment for mutt_simple_format()
Definition: curs_lib.h:45
Right justify the text.
Definition: curs_lib.h:49
Centre the text.
Definition: curs_lib.h:48
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
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:1090
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_format_s()

void mutt_format_s ( char *  buf,
size_t  buflen,
const char *  prec,
const char *  s 
)

Format a simple string.

Parameters
[out]bufBuffer in which to save string
[in]buflenBuffer length
[in]precField precision, e.g. "-3.4"
[in]sString to format

Definition at line 1241 of file curs_lib.c.

1242 {
1243  mutt_format_s_x(buf, buflen, prec, s, false);
1244 }
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:1204
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_format_s_tree()

void mutt_format_s_tree ( char *  buf,
size_t  buflen,
const char *  prec,
const char *  s 
)

Format a simple string with tree characters.

Parameters
[out]bufBuffer in which to save string
[in]buflenBuffer length
[in]precField precision, e.g. "-3.4"
[in]sString to format

Definition at line 1253 of file curs_lib.c.

1254 {
1255  mutt_format_s_x(buf, buflen, prec, s, true);
1256 }
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:1204
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_paddstr()

void mutt_paddstr ( int  n,
const char *  s 
)

Display a string on screen, padded if necessary.

Parameters
nFinal width of field
sString to display

Definition at line 1263 of file curs_lib.c.

1264 {
1265  wchar_t wc;
1266  size_t k;
1267  size_t len = mutt_str_len(s);
1268  mbstate_t mbstate;
1269 
1270  memset(&mbstate, 0, sizeof(mbstate));
1271  for (; len && (k = mbrtowc(&wc, s, len, &mbstate)); s += k, len -= k)
1272  {
1273  if ((k == (size_t)(-1)) || (k == (size_t)(-2)))
1274  {
1275  if (k == (size_t)(-1))
1276  memset(&mbstate, 0, sizeof(mbstate));
1277  k = (k == (size_t)(-1)) ? 1 : len;
1278  wc = ReplacementChar;
1279  }
1280  if (!IsWPrint(wc))
1281  wc = '?';
1282  const int w = wcwidth(wc);
1283  if (w >= 0)
1284  {
1285  if (w > n)
1286  break;
1287  mutt_window_addnstr((char *) s, k);
1288  n -= w;
1289  }
1290  }
1291  while (n-- > 0)
1292  mutt_window_addch(' ');
1293 }
#define IsWPrint(wc)
Definition: mbyte.h:40
wchar_t ReplacementChar
When a Unicode character can&#39;t be displayed, use this instead.
Definition: charset.c:58
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:500
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:488
int n
Definition: acutest.h:492
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_wstr_trunc()

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.

Parameters
[in]srcString to measure
[in]maxlenMaximum length of string in bytes
[in]maxwidMaximum width in screen columns
[out]widthSave the truncated screen column width
Return values
numBytes 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 1306 of file curs_lib.c.

1307 {
1308  wchar_t wc;
1309  size_t n, w = 0, l = 0, cl;
1310  int cw;
1311  mbstate_t mbstate;
1312 
1313  if (!src)
1314  goto out;
1315 
1316  n = mutt_str_len(src);
1317 
1318  memset(&mbstate, 0, sizeof(mbstate));
1319  for (w = 0; n && (cl = mbrtowc(&wc, src, n, &mbstate)); src += cl, n -= cl)
1320  {
1321  if ((cl == (size_t)(-1)) || (cl == (size_t)(-2)))
1322  {
1323  if (cl == (size_t)(-1))
1324  memset(&mbstate, 0, sizeof(mbstate));
1325  cl = (cl == (size_t)(-1)) ? 1 : n;
1326  wc = ReplacementChar;
1327  }
1328  cw = wcwidth(wc);
1329  /* hack because MUTT_TREE symbols aren't turned into characters
1330  * until rendered by print_enriched_string() */
1331  if ((cw < 0) && (src[0] == MUTT_SPECIAL_INDEX))
1332  {
1333  cl = 2; /* skip the index coloring sequence */
1334  cw = 0;
1335  }
1336  else if ((cw < 0) && (cl == 1) && (src[0] != '\0') && (src[0] < MUTT_TREE_MAX))
1337  cw = 1;
1338  else if (cw < 0)
1339  cw = 0; /* unprintable wchar */
1340  if ((cl + l > maxlen) || (cw + w > maxwid))
1341  break;
1342  l += cl;
1343  w += cw;
1344  }
1345 out:
1346  if (width)
1347  *width = w;
1348  return l;
1349 }
wchar_t ReplacementChar
When a Unicode character can&#39;t be displayed, use this instead.
Definition: charset.c:58
Colour indicator.
Definition: mutt_menu.h:74
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
int n
Definition: acutest.h:492
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_strwidth()

int mutt_strwidth ( const char *  s)

Measure a string's width in screen cells.

Parameters
sString to be measured
Return values
numScreen cells string would use

Definition at line 1356 of file curs_lib.c.

1357 {
1358  if (!s)
1359  return 0;
1360  return mutt_strnwidth(s, mutt_str_len(s));
1361 }
int mutt_strnwidth(const char *s, size_t n)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1369
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_strnwidth()

int mutt_strnwidth ( const char *  s,
size_t  n 
)

Measure a string's width in screen cells.

Parameters
sString to be measured
nLength of string to be measured
Return values
numScreen cells string would use

Definition at line 1369 of file curs_lib.c.

1370 {
1371  if (!s)
1372  return 0;
1373 
1374  wchar_t wc;
1375  int w;
1376  size_t k;
1377  mbstate_t mbstate;
1378 
1379  memset(&mbstate, 0, sizeof(mbstate));
1380  for (w = 0; n && (k = mbrtowc(&wc, s, n, &mbstate)); s += k, n -= k)
1381  {
1382  if (*s == MUTT_SPECIAL_INDEX)
1383  {
1384  s += 2; /* skip the index coloring sequence */
1385  k = 0;
1386  continue;
1387  }
1388 
1389  if ((k == (size_t)(-1)) || (k == (size_t)(-2)))
1390  {
1391  if (k == (size_t)(-1))
1392  memset(&mbstate, 0, sizeof(mbstate));
1393  k = (k == (size_t)(-1)) ? 1 : n;
1394  wc = ReplacementChar;
1395  }
1396  if (!IsWPrint(wc))
1397  wc = '?';
1398  w += wcwidth(wc);
1399  }
1400  return w;
1401 }
#define IsWPrint(wc)
Definition: mbyte.h:40
wchar_t ReplacementChar
When a Unicode character can&#39;t be displayed, use this instead.
Definition: charset.c:58
Colour indicator.
Definition: mutt_menu.h:74
int n
Definition: acutest.h:492
+ Here is the caller graph for this function:

Variable Documentation

◆ C_MetaKey

bool C_MetaKey

Config: Interpret 'ALT-x' as 'ESC-x'.

interpret ALT-x as ESC-x

Definition at line 70 of file curs_lib.c.

◆ MacroBufferCount

size_t MacroBufferCount = 0
static

Definition at line 80 of file curs_lib.c.

◆ MacroBufferLen

size_t MacroBufferLen = 0
static

Definition at line 81 of file curs_lib.c.

◆ MacroEvents

struct KeyEvent* MacroEvents
static

Definition at line 82 of file curs_lib.c.

◆ UngetCount

size_t UngetCount = 0
static

Definition at line 87 of file curs_lib.c.

◆ UngetLen

size_t UngetLen = 0
static

Definition at line 88 of file curs_lib.c.

◆ UngetKeyEvents

struct KeyEvent* UngetKeyEvents
static

Definition at line 89 of file curs_lib.c.

◆ MuttGetchTimeout

int MuttGetchTimeout = -1

Timeout in ms for mutt_getch()

Definition at line 91 of file curs_lib.c.