From f3d537dd7ac6fc5d1f7e2e7324e74fd19921b22b Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 27 Jul 2013 22:44:42 +0200 Subject: core: use two spaces to separate columns in /help, do not use columns when the commands fit on a single line --- src/core/wee-command.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 2bad83267..9c2ba6a88 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1923,14 +1923,22 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin, plugin_get_name (plugin), GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS)); - snprintf (str_format, sizeof (str_format), - " %%-%ds", max_length); - /* auto compute number of columns, max size is 90% of chat width */ - cols = ((gui_current_window->win_chat_width * 90) / 100) / (max_length + 1); + cols = ((gui_current_window->win_chat_width * 90) / 100) / (max_length + 2); if (cols == 0) cols = 1; lines = ((list_size - 1) / cols) + 1; + + if (lines == 1) + { + snprintf (str_format, sizeof (str_format), " %%s"); + } + else + { + snprintf (str_format, sizeof (str_format), + " %%-%ds", max_length); + } + for (line = 0; line < lines; line++) { str_line[0] = '\0'; @@ -1951,7 +1959,7 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin, } } } - gui_chat_printf (NULL, " %s", str_line); + gui_chat_printf (NULL, "%s", str_line); } } -- cgit v1.2.3