Formatting of /theme properties command output

This commit is contained in:
James Booth
2016-01-23 22:55:04 +00:00
parent 6ec3f71a54
commit 2df622f9fd
3 changed files with 64 additions and 45 deletions

View File

@@ -1735,10 +1735,10 @@ static struct cmd_t command_defs[] =
CMD_DESC(
"Load a theme, includes colours and UI options.")
CMD_ARGS(
{ "list", "List all available themes." },
{ "load <theme>", "Load the specified theme. 'default' will reset to the default theme." },
{ "colours", "Show the colour values as rendered by the terminal." },
{ "properties", "Show each themed property." })
{ "list", "List all available themes." },
{ "load <theme>", "Load the specified theme. 'default' will reset to the default theme." },
{ "colours", "Show colour values as rendered by the terminal." },
{ "properties", "Show colour settings for current theme." })
CMD_EXAMPLES(
"/theme list",
"/theme load forest")

View File

@@ -2010,25 +2010,44 @@ void
_cons_theme_bar_prop(theme_item_t theme, char *prop)
{
ProfWin *console = wins_get_console();
GString *str = g_string_new(" ");
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new(" ");
char *setting = theme_get_string(prop);
g_string_append_printf(str, "%-24s%s ", prop, setting);
g_string_append_printf(valstr, "%s ", setting);
theme_free_string(setting);
win_print(console, '-', 0, NULL, NO_EOL, theme, "", str->str);
win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, theme, "", valstr->str);
win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", "");
g_string_free(str, TRUE);
g_string_free(valstr, TRUE);
}
void
_cons_theme_prop(theme_item_t theme, char *prop)
{
ProfWin *console = wins_get_console();
GString *str = g_string_new(" ");
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new("");
char *setting = theme_get_string(prop);
g_string_append_printf(str, "%-24s%s", prop, setting);
g_string_append_printf(valstr, "%s", setting);
theme_free_string(setting);
win_print(console, '-', 0, NULL, 0, theme, "", str->str);
g_string_free(str, TRUE);
win_print(console, '-', 0, NULL, NO_DATE, theme, "", valstr->str);
g_string_free(valstr, TRUE);
// GString *str = g_string_new(" ");
// char *setting = theme_get_string(prop);
// g_string_append_printf(str, "%-24s%s", prop, setting);
// theme_free_string(setting);
// win_print(console, '-', 0, NULL, 0, theme, "", str->str);
// g_string_free(str, TRUE);
}
void