summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-12-16 11:26:34 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-12-16 11:26:34 +0100
commit6574c8876b6b50a8e05b66a7817a8df3a3a7e20f (patch)
treeaa5d0482347b2924c7e02108dbd2cbe33eee393a /src/core
parent6b76c21cae59dca49958eaeec9f62d1201c932c0 (diff)
downloadweechat-6574c8876b6b50a8e05b66a7817a8df3a3a7e20f.zip
Display "Commands..:" only if internal/other commands are found with /help
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-command.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 4b54e2d6a..793b7caa0 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -1376,7 +1376,7 @@ command_help (void *data, struct t_gui_buffer *buffer,
{
struct t_hook *ptr_hook;
struct t_config_option *ptr_option;
- int i, length;
+ int i, length, command_found;
char *string;
/* make C compiler happy */
@@ -1387,11 +1387,7 @@ command_help (void *data, struct t_gui_buffer *buffer,
/* display help for all commands */
if (argc == 1)
{
- gui_chat_printf (NULL, "");
- gui_chat_printf (NULL,
- /* TRANSLATORS: %s is "weechat" */
- _("%s internal commands:"),
- PACKAGE_NAME);
+ command_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -1400,6 +1396,15 @@ command_help (void *data, struct t_gui_buffer *buffer,
&& HOOK_COMMAND(ptr_hook, command)
&& HOOK_COMMAND(ptr_hook, command)[0])
{
+ if (!command_found)
+ {
+ gui_chat_printf (NULL, "");
+ gui_chat_printf (NULL,
+ /* TRANSLATORS: %s is "weechat" */
+ _("%s internal commands:"),
+ PACKAGE_NAME);
+ command_found = 1;
+ }
gui_chat_printf (NULL, " %s%s%s%s%s",
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
HOOK_COMMAND(ptr_hook, command),
@@ -1412,8 +1417,7 @@ command_help (void *data, struct t_gui_buffer *buffer,
_(HOOK_COMMAND(ptr_hook, description)) : "");
}
}
- gui_chat_printf (NULL, "");
- gui_chat_printf (NULL, _("Other commands:"));
+ command_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -1422,6 +1426,12 @@ command_help (void *data, struct t_gui_buffer *buffer,
&& HOOK_COMMAND(ptr_hook, command)
&& HOOK_COMMAND(ptr_hook, command)[0])
{
+ if (!command_found)
+ {
+ gui_chat_printf (NULL, "");
+ gui_chat_printf (NULL, _("Other commands:"));
+ command_found = 1;
+ }
gui_chat_printf (NULL, " %s%s%s%s%s",
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
HOOK_COMMAND(ptr_hook, command),