diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-07-27 22:44:42 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-07-27 22:44:42 +0200 |
commit | f3d537dd7ac6fc5d1f7e2e7324e74fd19921b22b (patch) | |
tree | 6eb3f29fe8c8c02f91f65fb0658d08c194d7c5f3 | |
parent | ca1e0dde07501093ac90244a06715b5c3bfb79ee (diff) | |
download | weechat-f3d537dd7ac6fc5d1f7e2e7324e74fd19921b22b.zip |
core: use two spaces to separate columns in /help, do not use columns when the commands fit on a single line
-rw-r--r-- | src/core/wee-command.c | 18 |
1 files 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); } } |