NeoMutt  2019-12-07-60-g0cfa53
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 <regex.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
#include "mutt/mutt.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 "globals.h"
#include "mutt_curses.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 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...
 
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...
 
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...
 
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_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. 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: globals.h:203
+ 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:36
WHERE bool OptForceRefresh
(pseudo) refresh even during macros
Definition: options.h:35
WHERE bool OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program ...
Definition: options.h:37
+ 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 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 == ctrl('G')) ? err : ret;
243 }
static struct KeyEvent * MacroEvents
Definition: curs_lib.c:82
static size_t MacroBufferCount
Definition: curs_lib.c:80
WHERE SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
Definition: globals.h:79
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:834
int ch
raw key pressed
Definition: keymap.h:62
WHERE bool OptIgnoreMacroEvents
(pseudo) don&#39;t process macro/push/exec events while set
Definition: options.h:36
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
Definition: curs_lib.c:513
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
#define ctrl(ch)
Definition: mutt_curses.h:67
static struct KeyEvent * UngetKeyEvents
Definition: curs_lib.c:89
An event such as a keypress.
Definition: keymap.h:60
void mutt_exit(int code)
Leave NeoMutt NOW.
Definition: main.c:207
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_window_get_coords(struct MuttWindow *win, int *row, int *col)
Get the cursor position in the Window.
Definition: mutt_window.c:221
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:100
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:176
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:113
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: globals.h:80
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:78
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_enter_state_free(struct EnterState **ptr)
Free an EnterState.
Definition: enter.c:820
char * data
Pointer to data.
Definition: buffer.h:35
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
struct EnterState * mutt_enter_state_new(void)
Create a new EnterState.
Definition: enter.c:125
Question/user input.
Definition: color.h:81
+ 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  struct Buffer *tmp = mutt_buffer_pool_get();
312 
313  mutt_buffer_addstr(tmp, buf);
314  int rc = mutt_buffer_get_field_full(field, tmp, complete, multiple, files, numfiles);
315  mutt_str_strfcpy(buf, mutt_b2s(tmp), buflen);
316 
318  return rc;
319 }
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.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
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
#define mutt_b2s(buf)
Definition: buffer.h:41
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_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:750
+ 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 331 of file curs_lib.c.

332 {
333  bool reset_ignoremacro = false;
334 
336  {
337  OptIgnoreMacroEvents = true;
338  reset_ignoremacro = true;
339  }
340  int rc = mutt_get_field(msg, buf, buflen, flags);
341  if (reset_ignoremacro)
342  OptIgnoreMacroEvents = false;
343 
344  return rc;
345 }
WHERE bool OptIgnoreMacroEvents
(pseudo) don&#39;t process macro/push/exec events while set
Definition: options.h:36
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:92
+ 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 352 of file curs_lib.c.

353 {
354  struct Buffer *cmd = mutt_buffer_pool_get();
355 
356  mutt_endwin();
357  mutt_buffer_file_expand_fmt_quote(cmd, editor, file);
358  if (mutt_system(mutt_b2s(cmd)) != 0)
359  {
360  mutt_error(_("Error running \"%s\""), mutt_b2s(cmd));
361  }
362  /* the terminal may have been resized while the editor owned it */
364  keypad(stdscr, true);
365  clearok(stdscr, true);
366 
368 }
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:100
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:545
#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:1423
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:52
+ 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 376 of file curs_lib.c.

377 {
378  struct KeyEvent ch;
379  char *yes = _("yes");
380  char *no = _("no");
381  char *answer_string = NULL;
382  int answer_string_wid, msg_wid;
383  size_t trunc_msg_len;
384  bool redraw = true;
385  int prompt_lines = 1;
386 
387  char *expr = NULL;
388  regex_t reyes;
389  regex_t reno;
390  char answer[2];
391 
392  answer[1] = '\0';
393 
394  bool reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] == '^') &&
395  (REG_COMP(&reyes, expr, REG_NOSUB) == 0);
396  bool reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] == '^') &&
397  (REG_COMP(&reno, expr, REG_NOSUB) == 0);
398 
399  /* In order to prevent the default answer to the question to wrapped
400  * around the screen in the even the question is wider than the screen,
401  * ensure there is enough room for the answer and truncate the question
402  * to fit. */
403  mutt_str_asprintf(&answer_string, " ([%s]/%s): ", (def == MUTT_YES) ? yes : no,
404  (def == MUTT_YES) ? no : yes);
405  answer_string_wid = mutt_strwidth(answer_string);
406  msg_wid = mutt_strwidth(msg);
407 
408  while (true)
409  {
410  if (redraw || SigWinch)
411  {
412  redraw = false;
413  if (SigWinch)
414  {
415  SigWinch = 0;
417  clearok(stdscr, true);
419  }
421  {
422  prompt_lines = (msg_wid + answer_string_wid + MuttMessageWindow->state.cols - 1) /
424  prompt_lines = MAX(1, MIN(3, prompt_lines));
425  }
426  if (prompt_lines != MuttMessageWindow->state.rows)
427  {
428  mutt_window_reflow_message_rows(prompt_lines);
430  }
431 
432  /* maxlen here is sort of arbitrary, so pick a reasonable upper bound */
433  trunc_msg_len = mutt_wstr_trunc(
434  msg, (size_t) 4 * prompt_lines * MuttMessageWindow->state.cols,
435  ((size_t) prompt_lines * MuttMessageWindow->state.cols) - answer_string_wid, NULL);
436 
439  mutt_window_addnstr(msg, trunc_msg_len);
440  mutt_window_addstr(answer_string);
443  }
444 
445  mutt_refresh();
446  /* SigWinch is not processed unless timeout is set */
447  mutt_getch_timeout(30 * 1000);
448  ch = mutt_getch();
449  mutt_getch_timeout(-1);
450  if (ch.ch == -2)
451  continue;
452  if (CI_is_return(ch.ch))
453  break;
454  if (ch.ch < 0)
455  {
456  def = MUTT_ABORT;
457  break;
458  }
459 
460  answer[0] = ch.ch;
461  if (reyes_ok ? (regexec(&reyes, answer, 0, 0, 0) == 0) : (tolower(ch.ch) == 'y'))
462  {
463  def = MUTT_YES;
464  break;
465  }
466  else if (reno_ok ? (regexec(&reno, answer, 0, 0, 0) == 0) : (tolower(ch.ch) == 'n'))
467  {
468  def = MUTT_NO;
469  break;
470  }
471  else
472  {
473  mutt_beep(false);
474  }
475  }
476 
477  FREE(&answer_string);
478 
479  if (reyes_ok)
480  regfree(&reyes);
481  if (reno_ok)
482  regfree(&reno);
483 
484  if (MuttMessageWindow->state.rows == 1)
485  {
487  }
488  else
489  {
492  }
493 
494  if (def == MUTT_ABORT)
495  {
496  /* when the users cancels with ^G, clear the message stored with
497  * mutt_message() so it isn't displayed when the screen is refreshed. */
499  }
500  else
501  {
502  mutt_window_addstr((char *) ((def == MUTT_YES) ? yes : no));
503  mutt_refresh();
504  }
505  return def;
506 }
#define CI_is_return(ch)
Definition: mutt_curses.h:72
#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:135
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:100
#define _(a)
Definition: message.h:28
int ch
raw key pressed
Definition: keymap.h:62
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:410
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:113
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition: regex3.h:52
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: globals.h:80
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
Plain text.
Definition: color.h:78
void mutt_window_reflow_message_rows(int mw_rows)
Resize the Message Window.
Definition: mutt_window.c:365
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
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:91
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1359
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:55
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
An event such as a keypress.
Definition: keymap.h:60
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
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:47
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
int mutt_str_asprintf(char **strp, const char *fmt,...)
Definition: string.c:1194
Question/user input.
Definition: color.h:81
+ 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 513 of file curs_lib.c.

514 {
515  mutt_flushinp();
517  if (C_Timeout)
518  mutt_getch_timeout(-1); /* restore blocking operation */
519  if (mutt_yesorno(_("Exit NeoMutt?"), MUTT_YES) == MUTT_YES)
520  {
521  mutt_exit(1);
522  }
525  SigInt = 0;
526 }
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
WHERE SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
Definition: globals.h:79
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:919
#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:376
Display a normal cursor.
Definition: mutt_curses.h:82
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
WHERE short C_Timeout
Config: Time to wait for user input in menus.
Definition: globals.h:151
Restore the previous cursor state.
Definition: mutt_curses.h:80
void mutt_exit(int code)
Leave NeoMutt NOW.
Definition: main.c:207
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 531 of file curs_lib.c.

532 {
534  return;
535 
540 }
Informational message.
Definition: color.h:76
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:135
Plain text.
Definition: color.h:78
WHERE char ErrorBuf[256]
Copy of the last error message.
Definition: globals.h:45
WHERE bool ErrorBufMessage
true if the last message was an error
Definition: globals.h:44
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:293
Error message.
Definition: color.h:71
WHERE bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
Definition: options.h:39
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
WHERE bool OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program ...
Definition: options.h:37
+ 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 545 of file curs_lib.c.

546 {
547  if (OptNoCurses)
548  return;
549 
550  int e = errno;
551 
552  /* at least in some situations (screen + xterm under SuSE11/12) endwin()
553  * doesn't properly flush the screen without an explicit call. */
554  mutt_refresh();
555  endwin();
556 
557  errno = e;
558 }
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:46
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 564 of file curs_lib.c.

565 {
566  char *p = strerror(errno);
567 
568  mutt_debug(LL_DEBUG1, "%s: %s (errno = %d)\n", s, p ? p : "unknown error", errno);
569  mutt_error("%s: %s (errno = %d)", s, p ? p : _("unknown error"), errno);
570 }
#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 578 of file curs_lib.c.

579 {
580  struct termios term;
581  struct termios old;
582 
583  int fd = open("/dev/tty", O_RDONLY);
584  if (fd < 0)
585  return EOF;
586 
587  tcgetattr(fd, &old); // Save the current tty settings
588 
589  term = old;
590  term.c_lflag &= ~(ICANON | ECHO); // Canonical (not line-buffered), don't echo the characters
591  term.c_cc[VMIN] = 1; // Wait for at least one character
592  term.c_cc[VTIME] = 255; // Wait for 25.5s
593  tcsetattr(fd, TCSANOW, &term);
594 
595  if (s)
596  fputs(s, stdout);
597  else
598  fputs(_("Press any key to continue..."), stdout);
599  fflush(stdout);
600 
601  char ch = '\0';
602  // Wait for a character. This might timeout, so loop.
603  while (read(fd, &ch, 1) == 0)
604  ;
605 
606  // Change the tty settings to be non-blocking
607  term.c_cc[VMIN] = 0; // Returning with zero characters is acceptable
608  term.c_cc[VTIME] = 0; // Don't wait
609  tcsetattr(fd, TCSANOW, &term);
610 
611  char buf[64];
612  while (read(fd, buf, sizeof(buf)) > 0) // Mop up any remaining chars
613  ;
614 
615  tcsetattr(fd, TCSANOW, &old); // Restore the previous tty settings
616  close(fd);
617 
618  fputs("\r\n", stdout);
620  return (ch >= 0) ? ch : EOF;
621 }
#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()

int mutt_dlg_dopager_observer ( struct NotifyCallback nc)

Listen for config changes affecting the dopager menus - Implements observer_t()

Definition at line 626 of file curs_lib.c.

627 {
628  if (!nc->event_data || !nc->global_data)
629  return -1;
630  if (nc->event_type != NT_CONFIG)
631  return 0;
632 
633  struct EventConfig *ec = nc->event_data;
634  struct MuttWindow *dlg = nc->global_data;
635 
636  if (mutt_str_strcmp(ec->name, "status_on_top") != 0)
637  return 0;
638 
639  struct MuttWindow *win_first = TAILQ_FIRST(&dlg->children);
640  if (!win_first)
641  return -1;
642 
643  if ((C_StatusOnTop && (win_first->type == WT_PAGER)) ||
644  (!C_StatusOnTop && (win_first->type != WT_PAGER)))
645  {
646  // Swap the Index and the IndexBar Windows
647  TAILQ_REMOVE(&dlg->children, win_first, entries);
648  TAILQ_INSERT_TAIL(&dlg->children, win_first, entries);
649  }
650 
651  mutt_window_reflow(dlg);
652  return 0;
653 }
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: globals.h:255
#define TAILQ_FIRST(head)
Definition: queue.h:716
A config-change event.
Definition: subset.h:68
A division of the screen.
Definition: mutt_window.h:86
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
#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:44
Config has changed.
Definition: notify_type.h:34
Window containing paged free-form text.
Definition: mutt_window.h:74
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:346
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:99
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:101
const char * name
Name of config item that changed.
Definition: subset.h:71
int mutt_str_strcmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:615
+ 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 664 of file curs_lib.c.

666 {
667  struct Pager info2 = { 0 };
668  if (!info)
669  info = &info2;
670 
671  struct MuttWindow *dlg =
674  dlg->type = WT_DIALOG;
675  struct MuttWindow *pager =
678  pager->type = WT_PAGER;
679  struct MuttWindow *pbar = mutt_window_new(
681  pbar->type = WT_PAGER_BAR;
682 
683  if (C_StatusOnTop)
684  {
685  mutt_window_add_child(dlg, pbar);
686  mutt_window_add_child(dlg, pager);
687  }
688  else
689  {
690  mutt_window_add_child(dlg, pager);
691  mutt_window_add_child(dlg, pbar);
692  }
693 
695  dialog_push(dlg);
696 
697  info->win_ibar = NULL;
698  info->win_index = NULL;
699  info->win_pbar = pbar;
700  info->win_pager = pager;
701 
702  int rc;
703 
704  if (!C_Pager || (mutt_str_strcmp(C_Pager, "builtin") == 0))
705  rc = mutt_pager(banner, tempfile, do_color, info);
706  else
707  {
708  struct Buffer *cmd = mutt_buffer_pool_get();
709 
710  mutt_endwin();
712  if (mutt_system(mutt_b2s(cmd)) == -1)
713  {
714  mutt_error(_("Error running \"%s\""), mutt_b2s(cmd));
715  rc = -1;
716  }
717  else
718  rc = 0;
719  mutt_file_unlink(tempfile);
721  }
722 
723  dialog_pop();
725  mutt_window_free(&dlg);
726  return rc;
727 }
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: globals.h:255
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:75
Dialog (nested Windows) displayed to the user.
Definition: mutt_window.h:68
Window uses all available vertical space.
Definition: mutt_window.h:33
void dialog_pop(void)
Hide a Window from the user.
Definition: mutt_window.c:623
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:603
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:194
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
int mutt_dlg_dopager_observer(struct NotifyCallback *nc)
Listen for config changes affecting the dopager menus - Implements observer_t()
Definition: curs_lib.c:626
A division of the screen.
Definition: mutt_window.h:86
An email being displayed.
Definition: pager.h:65
Container for Accounts, Notifications.
Definition: neomutt.h:35
bool notify_observer_add(struct Notify *notify, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:154
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:75
Window has a fixed size.
Definition: mutt_window.h:42
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:545
struct MuttWindow * mutt_window_new(enum MuttWindowOrientation orient, enum MuttWindowSize size, int rows, int cols)
Create a new Window.
Definition: mutt_window.c:57
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:186
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:47
struct Notify * notify
Notifications handler.
Definition: neomutt.h:37
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:471
Window containing paged free-form text.
Definition: mutt_window.h:74
#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:1423
struct MuttWindow * win_ibar
Definition: pager.h:73
WHERE char * C_Pager
Config: External command for viewing messages, or &#39;builtin&#39; to use NeoMutt&#39;s.
Definition: globals.h:132
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:2205
Window wants as much space as possible.
Definition: mutt_window.h:43
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:101
int mutt_str_strcmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:615
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:52
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_enter_fname_full()

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.

Parameters
[in]promptPrompt
[in]bufBuffer for the result
[in]buflenLength of the buffer
[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 742 of file curs_lib.c.

744 {
745  struct Buffer *fname = mutt_buffer_pool_get();
746 
747  mutt_buffer_addstr(fname, NONULL(buf));
748  int rc = mutt_buffer_enter_fname_full(prompt, fname, mailbox, multiple, files,
749  numfiles, flags);
750  mutt_str_strfcpy(buf, mutt_b2s(fname), buflen);
751 
752  mutt_buffer_pool_release(&fname);
753  return rc;
754 }
#define NONULL(x)
Definition: string2.h:37
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.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
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
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
#define mutt_b2s(buf)
Definition: buffer.h:41
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:750
+ Here is the call 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 768 of file curs_lib.c.

771 {
772  struct KeyEvent ch;
773 
776  mutt_window_addstr(_(" ('?' for list): "));
778  if (!mutt_buffer_is_empty(fname))
781  mutt_refresh();
782 
783  do
784  {
785  ch = mutt_getch();
786  } while (ch.ch == -2);
787  if (ch.ch < 0)
788  {
790  return -1;
791  }
792  else if (ch.ch == '?')
793  {
794  mutt_refresh();
795  mutt_buffer_reset(fname);
796 
797  if (flags == MUTT_SEL_NO_FLAGS)
798  flags = MUTT_SEL_FOLDER;
799  if (multiple)
800  flags |= MUTT_SEL_MULTI;
801  if (mailbox)
802  flags |= MUTT_SEL_MAILBOX;
803  mutt_buffer_select_file(fname, flags, files, numfiles);
804  }
805  else
806  {
807  char *pc = mutt_mem_malloc(mutt_str_strlen(prompt) + 3);
808 
809  sprintf(pc, "%s: ", prompt);
810  if (ch.op == OP_NULL)
811  mutt_unget_event(ch.ch, 0);
812  else
813  mutt_unget_event(0, ch.op);
814 
815  mutt_buffer_alloc(fname, 1024);
816  if (mutt_buffer_get_field_full(pc, fname, (mailbox ? MUTT_EFILE : MUTT_FILE) | MUTT_CLEAR,
817  multiple, files, numfiles) != 0)
818  {
819  mutt_buffer_reset(fname);
820  }
821  FREE(&pc);
822  }
823 
824  return 0;
825 }
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:68
void mutt_buffer_select_file(struct Buffer *file, SelectFileFlags flags, char ***files, int *numfiles)
Let the user select a file.
Definition: browser.c:1181
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:135
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:834
#define _(a)
Definition: message.h:28
int ch
raw key pressed
Definition: keymap.h:62
#define MUTT_SEL_NO_FLAGS
No flags are set.
Definition: browser.h:44
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
#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:113
Plain text.
Definition: color.h:78
#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:60
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
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:293
#define MUTT_FILE
Do file completion.
Definition: mutt.h:64
#define MUTT_SEL_MAILBOX
Select a mailbox.
Definition: browser.h:45
#define MUTT_EFILE
Do file completion, plus incoming folders.
Definition: mutt.h:65
#define FREE(x)
Definition: memory.h:40
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
Question/user input.
Definition: color.h:81
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 834 of file curs_lib.c.

835 {
836  struct KeyEvent tmp;
837 
838  tmp.ch = ch;
839  tmp.op = op;
840 
841  if (UngetCount >= UngetLen)
842  mutt_mem_realloc(&UngetKeyEvents, (UngetLen += 16) * sizeof(struct KeyEvent));
843 
844  UngetKeyEvents[UngetCount++] = tmp;
845 }
int op
function op
Definition: keymap.h:63
int ch
raw key pressed
Definition: keymap.h:62
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:60
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 853 of file curs_lib.c.

854 {
855  const char *p = s + mutt_str_strlen(s) - 1;
856 
857  while (p >= s)
858  {
859  mutt_unget_event((unsigned char) *p--, 0);
860  }
861 }
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:834
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
+ 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 871 of file curs_lib.c.

872 {
873  struct KeyEvent tmp;
874 
875  tmp.ch = ch;
876  tmp.op = op;
877 
879  mutt_mem_realloc(&MacroEvents, (MacroBufferLen += 128) * sizeof(struct KeyEvent));
880 
881  MacroEvents[MacroBufferCount++] = tmp;
882 }
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:63
int ch
raw key pressed
Definition: keymap.h:62
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:60
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 890 of file curs_lib.c.

891 {
892  UngetCount = 0;
893  while (MacroBufferCount > 0)
894  {
895  if (MacroEvents[--MacroBufferCount].op == OP_END_COND)
896  return;
897  }
898 }
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:63
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 907 of file curs_lib.c.

908 {
909  while (UngetCount > 0)
910  {
911  if (UngetKeyEvents[--UngetCount].op == OP_END_COND)
912  return;
913  }
914 }
int op
function op
Definition: keymap.h:63
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 919 of file curs_lib.c.

920 {
921  UngetCount = 0;
922  MacroBufferCount = 0;
923  flushinp();
924 }
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 933 of file curs_lib.c.

934 {
935  struct KeyEvent ch;
936  int choice;
937  bool redraw = true;
938  int prompt_lines = 1;
939 
940  bool opt_cols = ((Colors->defs[MT_COLOR_OPTIONS] != 0) &&
942 
943  while (true)
944  {
945  if (redraw || SigWinch)
946  {
947  redraw = false;
948  if (SigWinch)
949  {
950  SigWinch = 0;
952  clearok(stdscr, true);
954  }
956  {
957  int width = mutt_strwidth(prompt) + 2; // + '?' + space
958  /* If we're going to colour the options,
959  * make an assumption about the modified prompt size. */
960  if (opt_cols)
961  width -= 2 * mutt_str_strlen(letters);
962 
963  prompt_lines = (width + MuttMessageWindow->state.cols - 1) /
965  prompt_lines = MAX(1, MIN(3, prompt_lines));
966  }
967  if (prompt_lines != MuttMessageWindow->state.rows)
968  {
969  mutt_window_reflow_message_rows(prompt_lines);
971  }
972 
974 
975  if ((Colors->defs[MT_COLOR_OPTIONS] != 0) &&
977  {
978  char *cur = NULL;
979 
980  while ((cur = strchr(prompt, '(')))
981  {
982  // write the part between prompt and cur using MT_COLOR_PROMPT
984  mutt_window_addnstr(prompt, cur - prompt);
985 
986  if (isalnum(cur[1]) && (cur[2] == ')'))
987  {
988  // we have a single letter within parentheses
990  mutt_window_addch(cur[1]);
991  prompt = cur + 3;
992  }
993  else
994  {
995  // we have a parenthesis followed by something else
996  mutt_window_addch(cur[0]);
997  prompt = cur + 1;
998  }
999  }
1000  }
1001 
1003  mutt_window_addstr(prompt);
1005 
1006  mutt_window_addch(' ');
1008  }
1009 
1010  mutt_refresh();
1011  /* SigWinch is not processed unless timeout is set */
1012  mutt_getch_timeout(30 * 1000);
1013  ch = mutt_getch();
1014  mutt_getch_timeout(-1);
1015  if (ch.ch == -2)
1016  continue;
1017  /* (ch.ch == 0) is technically possible. Treat the same as < 0 (abort) */
1018  if ((ch.ch <= 0) || CI_is_return(ch.ch))
1019  {
1020  choice = -1;
1021  break;
1022  }
1023  else
1024  {
1025  char *p = strchr(letters, ch.ch);
1026  if (p)
1027  {
1028  choice = p - letters + 1;
1029  break;
1030  }
1031  else if ((ch.ch <= '9') && (ch.ch > '0'))
1032  {
1033  choice = ch.ch - '0';
1034  if (choice <= mutt_str_strlen(letters))
1035  break;
1036  }
1037  }
1038  mutt_beep(false);
1039  }
1040  if (MuttMessageWindow->state.rows == 1)
1041  {
1043  }
1044  else
1045  {
1048  }
1049  mutt_refresh();
1050  return choice;
1051 }
#define CI_is_return(ch)
Definition: mutt_curses.h:72
#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:132
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:135
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:100
int ch
raw key pressed
Definition: keymap.h:62
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
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:410
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:113
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: globals.h:80
Plain text.
Definition: color.h:78
void mutt_window_reflow_message_rows(int mw_rows)
Resize the Message Window.
Definition: mutt_window.c:365
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
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:91
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1359
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:55
An event such as a keypress.
Definition: keymap.h:60
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
Definition: color.h:130
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:398
void mutt_getch_timeout(int delay)
Set the getch() timeout.
Definition: curs_lib.c:144
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
Options in prompt.
Definition: color.h:79
Question/user input.
Definition: color.h:81
+ 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 1059 of file curs_lib.c.

1060 {
1061  char buf[MB_LEN_MAX * 2];
1062  mbstate_t mbstate;
1063  size_t n1, n2;
1064 
1065  memset(&mbstate, 0, sizeof(mbstate));
1066  if (((n1 = wcrtomb(buf, wc, &mbstate)) == (size_t)(-1)) ||
1067  ((n2 = wcrtomb(buf + n1, 0, &mbstate)) == (size_t)(-1)))
1068  {
1069  return -1; /* ERR */
1070  }
1071  else
1072  {
1073  return mutt_window_addstr(buf);
1074  }
1075 }
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
+ 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 1093 of file curs_lib.c.

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

1208 {
1209  enum FormatJustify justify = JUSTIFY_RIGHT;
1210  char *p = NULL;
1211  int min_width;
1212  int max_width = INT_MAX;
1213 
1214  if (*prec == '-')
1215  {
1216  prec++;
1217  justify = JUSTIFY_LEFT;
1218  }
1219  else if (*prec == '=')
1220  {
1221  prec++;
1222  justify = JUSTIFY_CENTER;
1223  }
1224  min_width = strtol(prec, &p, 10);
1225  if (*p == '.')
1226  {
1227  prec = p + 1;
1228  max_width = strtol(prec, &p, 10);
1229  if (p <= prec)
1230  max_width = INT_MAX;
1231  }
1232 
1233  mutt_simple_format(buf, buflen, min_width, max_width, justify, ' ', s,
1234  mutt_str_strlen(s), arboreal);
1235 }
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
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
Centre the text.
Definition: curs_lib.h:48
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
+ 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 1244 of file curs_lib.c.

1245 {
1246  mutt_format_s_x(buf, buflen, prec, s, false);
1247 }
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
+ 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 1256 of file curs_lib.c.

1257 {
1258  mutt_format_s_x(buf, buflen, prec, s, true);
1259 }
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
+ 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 1266 of file curs_lib.c.

1267 {
1268  wchar_t wc;
1269  size_t k;
1270  size_t len = mutt_str_strlen(s);
1271  mbstate_t mbstate;
1272 
1273  memset(&mbstate, 0, sizeof(mbstate));
1274  for (; len && (k = mbrtowc(&wc, s, len, &mbstate)); s += k, len -= k)
1275  {
1276  if ((k == (size_t)(-1)) || (k == (size_t)(-2)))
1277  {
1278  if (k == (size_t)(-1))
1279  memset(&mbstate, 0, sizeof(mbstate));
1280  k = (k == (size_t)(-1)) ? 1 : len;
1281  wc = ReplacementChar;
1282  }
1283  if (!IsWPrint(wc))
1284  wc = '?';
1285  const int w = wcwidth(wc);
1286  if (w >= 0)
1287  {
1288  if (w > n)
1289  break;
1290  mutt_window_addnstr((char *) s, k);
1291  n -= w;
1292  }
1293  }
1294  while (n-- > 0)
1295  mutt_window_addch(' ');
1296 }
#define IsWPrint(wc)
Definition: mbyte.h:40
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
wchar_t ReplacementChar
When a Unicode character can&#39;t be displayed, use this instead.
Definition: charset.c:59
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:410
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:398
+ 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 1309 of file curs_lib.c.

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

1360 {
1361  if (!s)
1362  return 0;
1363  return mutt_strnwidth(s, mutt_str_strlen(s));
1364 }
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
int mutt_strnwidth(const char *s, size_t n)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1372
+ 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 1372 of file curs_lib.c.

1373 {
1374  if (!s)
1375  return 0;
1376 
1377  wchar_t wc;
1378  int w;
1379  size_t k;
1380  mbstate_t mbstate;
1381 
1382  memset(&mbstate, 0, sizeof(mbstate));
1383  for (w = 0; n && (k = mbrtowc(&wc, s, n, &mbstate)); s += k, n -= k)
1384  {
1385  if (*s == MUTT_SPECIAL_INDEX)
1386  {
1387  s += 2; /* skip the index coloring sequence */
1388  k = 0;
1389  continue;
1390  }
1391 
1392  if ((k == (size_t)(-1)) || (k == (size_t)(-2)))
1393  {
1394  if (k == (size_t)(-1))
1395  memset(&mbstate, 0, sizeof(mbstate));
1396  k = (k == (size_t)(-1)) ? 1 : n;
1397  wc = ReplacementChar;
1398  }
1399  if (!IsWPrint(wc))
1400  wc = '?';
1401  w += wcwidth(wc);
1402  }
1403  return w;
1404 }
#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:59
Colour indicator.
Definition: mutt_menu.h:76
+ 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.