Commit a9dd873b authored by TAKAHASHI Tamotsu's avatar TAKAHASHI Tamotsu

Ensure that set doesn't change variables from within the help screen. I think

this is a gross approach, and probably overkill, but it's the fault of the
original code design, not Tamo's patch. Until a better way falls from the sky,
this Closes: #2011.
parent 8cd9fc40
...@@ -49,6 +49,15 @@ ...@@ -49,6 +49,15 @@
#include <errno.h> #include <errno.h>
#include <sys/wait.h> #include <sys/wait.h>
#define CHECK_PAGER \
if ((CurrentMenu == MENU_PAGER) && \
(MuttVars[idx].flags & R_RESORT)) \
{ \
snprintf (err->data, err->dsize, \
_("Not available in this menu.")); \
return (-1); \
} else
void toggle_quadoption (int opt) void toggle_quadoption (int opt)
{ {
int n = opt/4; int n = opt/4;
...@@ -1261,12 +1270,26 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1261,12 +1270,26 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
if (!mutt_strcmp ("all", tmp->data)) if (!mutt_strcmp ("all", tmp->data))
{ {
if (CurrentMenu == MENU_PAGER)
{
snprintf (err->data, err->dsize, _("Not available in this menu."));
return (-1);
}
for (idx = 0; MuttVars[idx].option; idx++) for (idx = 0; MuttVars[idx].option; idx++)
mutt_restore_default (&MuttVars[idx]); mutt_restore_default (&MuttVars[idx]);
set_option (OPTFORCEREDRAWINDEX);
set_option (OPTFORCEREDRAWPAGER);
set_option (OPTSORTSUBTHREADS);
set_option (OPTNEEDRESORT);
set_option (OPTRESORTINIT);
set_option (OPTREDRAWTREE);
return 0; return 0;
} }
else else
{
CHECK_PAGER;
mutt_restore_default (&MuttVars[idx]); mutt_restore_default (&MuttVars[idx]);
}
} }
else if (DTYPE (MuttVars[idx].type) == DT_BOOL) else if (DTYPE (MuttVars[idx].type) == DT_BOOL)
{ {
...@@ -1298,6 +1321,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1298,6 +1321,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
return 0; return 0;
} }
CHECK_PAGER;
if (unset) if (unset)
unset_option (MuttVars[idx].data); unset_option (MuttVars[idx].data);
else if (inv) else if (inv)
...@@ -1311,6 +1335,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1311,6 +1335,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
{ {
if (unset) if (unset)
{ {
CHECK_PAGER;
if (DTYPE (MuttVars[idx].type) == DT_ADDR) if (DTYPE (MuttVars[idx].type) == DT_ADDR)
rfc822_free_address ((ADDRESS **) MuttVars[idx].data); rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
else else
...@@ -1337,6 +1362,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1337,6 +1362,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
} }
else else
{ {
CHECK_PAGER;
s->dptr++; s->dptr++;
/* copy the value of the string */ /* copy the value of the string */
...@@ -1385,6 +1411,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1385,6 +1411,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
break; break;
} }
CHECK_PAGER;
s->dptr++; s->dptr++;
/* copy the value of the string */ /* copy the value of the string */
...@@ -1478,6 +1505,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1478,6 +1505,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
break; break;
} }
CHECK_PAGER;
s->dptr++; s->dptr++;
/* copy the value of the string */ /* copy the value of the string */
...@@ -1502,6 +1530,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1502,6 +1530,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
break; break;
} }
CHECK_PAGER;
s->dptr++; s->dptr++;
mutt_extract_token (tmp, s, 0); mutt_extract_token (tmp, s, 0);
...@@ -1540,6 +1569,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1540,6 +1569,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
break; break;
} }
CHECK_PAGER;
if (*s->dptr == '=') if (*s->dptr == '=')
{ {
s->dptr++; s->dptr++;
...@@ -1610,6 +1640,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ...@@ -1610,6 +1640,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
p); p);
return 0; return 0;
} }
CHECK_PAGER;
s->dptr++; s->dptr++;
mutt_extract_token (tmp, s , 0); mutt_extract_token (tmp, s , 0);
......
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