summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-11-09 11:06:02 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-11-09 11:06:02 +0000
commitfc1c8ec2843238b2cdddc12ff2944120242413a7 (patch)
tree112a22bace07647b6f8477e106a9265188bf4575 /init.c
parenta61a9d141b010ef6c9e9cad97097868cb9150cf4 (diff)
The attached patch fixes a bug in :set variable=<TAB> where variables
of type DT_SORT were not getting expanded (only 4 of them, but a bug nevertheless). From Vikas.
Diffstat (limited to 'init.c')
-rw-r--r--init.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/init.c b/init.c
index 8af87bcc..87c3bf4b 100644
--- a/init.c
+++ b/init.c
@@ -1402,6 +1402,29 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
snprintf(pt, dlen, "%s%s", tmp, vals[quadoption (MuttVars[idx].data)]);
else if (DTYPE (MuttVars[idx].type) == DT_NUM)
snprintf (pt, dlen, "%s%d", tmp, (*((short *) MuttVars[idx].data)));
+ else if (DTYPE (MuttVars[idx].type) == DT_SORT)
+ {
+ const struct mapping_t *map;
+ char *p;
+
+ switch (MuttVars[idx].type & DT_SUBTYPE_MASK)
+ {
+ case DT_SORT_ALIAS:
+ map = SortAliasMethods;
+ break;
+ case DT_SORT_BROWSER:
+ map = SortBrowserMethods;
+ break;
+ default:
+ map = SortMethods;
+ break;
+ }
+ p = mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK, map);
+ snprintf (pt, dlen, "%s\"%s%s%s\"", tmp,
+ (*((short *) MuttVars[idx].data) & SORT_REVERSE) ? "reverse-" : "",
+ (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" : "",
+ p);
+ }
else
return 0;
return 1;