From bf2d97f8deef91b28f482aeee973e27f91052b4a Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Fri, 12 Nov 2021 20:02:53 +0100 Subject: [PATCH] Fix status line when toggling general options The regression was introduced by #944 in 80b40c20607d9d2b324c8a5a8c390d0c89de600b. Fixes #1163 --- src/prompt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/prompt.c b/src/prompt.c index bc037a953..8c36de4d8 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -721,7 +721,9 @@ prompt_toggle_option(struct view *view, const char *argv[], const char *prefix, /* Define a partial version of success() to format the option name as a suffix to the view name, * thereby reducing the arguments needed by success() to only the option value and its format string. */ -#define Success(opt_fmt, opt_val) success(":set %s-view-%s = " opt_fmt, view->name, name, opt_val) +#define Success(opt_fmt, opt_val) *prefix \ + ? success(":set %s-view-%s = " opt_fmt, view->name, name, opt_val) \ + : success(":set %s = " opt_fmt, name, opt_val) char name[SIZEOF_STR]; @@ -856,7 +858,7 @@ prompt_toggle(struct view *view, const char *argv[], enum view_flag *flags) struct sort_state *sort = &view->sort; sort_view(view, sort_field); - return success("set %s = %s", option, + return success(":set %s = %s", option, sort_field ? view_column_name(get_sort_field(view)) : sort->reverse ? "descending" : "ascending"); }