summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
authorBrendan Cully <brendan@kublai.com>2007-03-03 18:47:41 -0800
committerBrendan Cully <brendan@kublai.com>2007-03-03 18:47:41 -0800
commit26b5e1a5232046ebc941a54993ab13904f3af6c2 (patch)
tree59a019013a495833083d5959fa58ae0a41de090e /init.c
parentdc99b7160c21b0722ec97e01333707f351e21f93 (diff)
Add $wrap, which supersedes $wrapmargin.
When set to a positive number, wrap at that column. When set to a negative number, keep that many characters empty on the right.
Diffstat (limited to 'init.c')
-rw-r--r--init.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/init.c b/init.c
index ce69d166..0008ab7f 100644
--- a/init.c
+++ b/init.c
@@ -1974,8 +1974,13 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
if (query || *s->dptr != '=')
{
+ val = *ptr;
+ /* compatibility alias */
+ if (mutt_strcmp (MuttVars[idx].option, "wrapmargin") == 0)
+ val = *ptr < 0 ? -*ptr : 0;
+
/* user requested the value of this variable */
- snprintf (err->data, err->dsize, "%s=%d", MuttVars[idx].option, *ptr);
+ snprintf (err->data, err->dsize, "%s=%d", MuttVars[idx].option, val);
break;
}
@@ -2006,6 +2011,13 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
if (*ptr < 0)
*ptr = 0;
}
+ else if (mutt_strcmp (MuttVars[idx].option, "wrapmargin") == 0)
+ {
+ if (*ptr < 0)
+ *ptr = 0;
+ else
+ *ptr = -*ptr;
+ }
}
else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
{
@@ -2547,7 +2559,15 @@ static int var_to_string (int idx, char* val, size_t len)
else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
strfcpy (tmp, vals[quadoption (MuttVars[idx].data)], sizeof (tmp));
else if (DTYPE (MuttVars[idx].type) == DT_NUM)
- snprintf (tmp, sizeof (tmp), "%d", (*((short *) MuttVars[idx].data)));
+ {
+ short sval = *((short *) MuttVars[idx].data);
+
+ /* avert your eyes, gentle reader */
+ if (mutt_strcmp (MuttVars[idx].option, "wrapmargin") == 0)
+ sval = sval > 0 ? 0 : -sval;
+
+ snprintf (tmp, sizeof (tmp), "%d", sval);
+ }
else if (DTYPE (MuttVars[idx].type) == DT_SORT)
{
const struct mapping_t *map;