Commit 2a5f051c authored by Brendan Cully's avatar Brendan Cully

This patch redoes yesterday's unbuffered input patch. Now it uses a

pseudo-option, which means less mess to carry down the call stack.
It also made it much easier to have the SSL certificate menu be
unbuffered, which it is now. So push commands won't annoy you when
entering passwords or accepting certificates.
parent 568f3435
......@@ -57,12 +57,12 @@ void mutt_refresh (void)
refresh ();
}
event_t _mutt_getch (int flags)
event_t mutt_getch (void)
{
int ch;
event_t err = {-1, OP_NULL }, ret;
if (!(flags & M_KM_UNBUFFERED) && UngetCount)
if (!option(OPTUNBUFFEREDINPUT) && UngetCount)
return (KeyEvent[--UngetCount]);
SigInt = 0;
......@@ -125,7 +125,9 @@ int mutt_get_password (char *msg, char *buf, size_t buflen)
CLEARLINE (LINES-1);
addstr (msg);
set_option (OPTUNBUFFEREDINPUT);
rc = mutt_enter_string (buf, buflen, LINES - 1, mutt_strlen (msg), M_PASS);
unset_option (OPTUNBUFFEREDINPUT);
CLEARLINE (LINES-1);
return (rc);
}
......
......@@ -256,7 +256,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
}
mutt_refresh ();
if ((ch = _km_dokey (MENU_EDITOR, pass ? M_KM_UNBUFFERED : 0)) == -1)
if ((ch = km_dokey (MENU_EDITOR)) == -1)
{
rv = -1;
goto bye;
......
......@@ -357,7 +357,7 @@ static int retry_generic (int menu, keycode_t *keys, int keyslen, int lastkey)
* OP_NULL no function bound to key sequence
* -1 error occured while reading input
*/
int _km_dokey (int menu, int flags)
int km_dokey (int menu)
{
event_t tmp;
struct keymap_t *map = Keymaps[menu];
......@@ -374,7 +374,7 @@ int _km_dokey (int menu, int flags)
if (menu != MENU_EDITOR)
timeout ((Timeout > 0 ? Timeout : 60) * 1000);
tmp = _mutt_getch(flags);
tmp = mutt_getch();
if (menu != MENU_EDITOR)
timeout (-1); /* restore blocking operation */
......
......@@ -27,8 +27,7 @@ typedef short keycode_t;
void km_bind (char *, int, int, char *, char *);
void km_bindkey (char *, int, int);
#define km_dokey(menu) _km_dokey(menu, 0)
int _km_dokey (int, int);
int km_dokey (int);
/* entry in the keymap tree */
struct keymap_t
......
......@@ -478,6 +478,7 @@ enum
OPTREDRAWTREE, /* (pseudo) redraw the thread tree */
OPTPGPCHECKTRUST, /* (pseudo) used by pgp_select_key () */
OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
OPTMAX
};
......
......@@ -87,8 +87,7 @@ void mutt_curs_set (int);
#define CI_is_return(c) ((c) == '\r' || (c) == '\n')
#endif
#define mutt_getch() _mutt_getch(0)
event_t _mutt_getch (int);
event_t mutt_getch (void);
void mutt_endwin (const char *);
void mutt_flushinp (void);
......
......@@ -629,6 +629,7 @@ static int ssl_check_certificate (sslsockdata * data)
menu->help = helpstr;
done = 0;
set_option(OPTUNBUFFEREDINPUT);
while (!done)
{
switch (mutt_menuLoop (menu))
......@@ -662,6 +663,7 @@ static int ssl_check_certificate (sslsockdata * data)
break;
}
}
unset_option(OPTUNBUFFEREDINPUT);
mutt_menuDestroy (&menu);
return (done == 2);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment