1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 03:33:12 +02:00

Improved /help command output

This commit is contained in:
Sebastien Helleu
2005-02-17 22:48:44 +00:00
parent ca50f2c8fc
commit 5cdcfdebb7
10 changed files with 304 additions and 380 deletions
+20 -28
View File
@@ -1148,29 +1148,31 @@ weechat_cmd_help (int argc, char **argv)
if (argc == 0)
{
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, "\n");
gui_printf (NULL,
_("> List of %s internal commands:\n"),
_("%s internal commands:\n"),
PACKAGE_NAME);
gui_printf (NULL, "\n");
for (i = 0; weechat_commands[i].command_name; i++)
{
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
weechat_commands[i].command_name);
gui_printf (NULL, " - %s\n",
_(weechat_commands[i].command_description));
}
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, _("> List of IRC commands:\n"));
gui_printf (NULL, "\n");
gui_printf (NULL, _("IRC commands:\n"));
gui_printf (NULL, "\n");
for (i = 0; irc_commands[i].command_name; i++)
{
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
{
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
irc_commands[i].command_name);
gui_printf (NULL, " - %s\n",
_(irc_commands[i].command_description));
}
}
}
if (argc == 1)
{
@@ -1178,24 +1180,19 @@ weechat_cmd_help (int argc, char **argv)
{
if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
{
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, _("> Help on %s internal command \""), PACKAGE_NAME);
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
weechat_commands[i].command_name);
gui_printf (NULL, "\":\n");
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, _("Syntax: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s",
gui_printf (NULL, "\n");
gui_printf (NULL, "[w]");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
weechat_commands[i].command_name);
if (weechat_commands[i].arguments &&
weechat_commands[i].arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s\n",
_(weechat_commands[i].arguments));
else
gui_printf (NULL, "\n");
if (weechat_commands[i].arguments_description &&
weechat_commands[i].arguments_description[0])
gui_printf (NULL, "%s\n",
gui_printf (NULL, "\n%s\n",
_(weechat_commands[i].arguments_description));
return 0;
}
@@ -1205,24 +1202,19 @@ weechat_cmd_help (int argc, char **argv)
if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0)
&& (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg))
{
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, _("> Help on IRC command \""));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
irc_commands[i].command_name);
gui_printf (NULL, "\":\n");
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, _("Syntax: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s",
gui_printf (NULL, "\n");
gui_printf (NULL, "[i]");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
irc_commands[i].command_name);
if (irc_commands[i].arguments &&
irc_commands[i].arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s\n",
_(irc_commands[i].arguments));
else
gui_printf (NULL, "\n");
if (irc_commands[i].arguments_description &&
irc_commands[i].arguments_description[0])
gui_printf (NULL, "%s\n",
gui_printf (NULL, "\n%s\n",
_(irc_commands[i].arguments_description));
return 0;
}
+6 -10
View File
@@ -401,7 +401,10 @@ gui_get_line_num_splits (t_gui_window *window, t_gui_line *line)
width = window->win_chat_width - line->length_align;
}
return (length % width == 0) ? (length / width) : ((length / width) + 1);
if (length == 0)
return 1;
else
return (length % width == 0) ? (length / width) : ((length / width) + 1);
}
/*
@@ -2241,15 +2244,8 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
if (pos)
{
pos[0] = '\n';
if ((buffer->num_displayed > 0) /*&& (gui_current_window->sub_lines == 0)*/)
{
/*if ((buffer->window->win_chat_cursor_y
+ gui_get_line_num_splits (buffer, buffer->last_line)) >
(buffer->window->win_chat_height - 1))*/
gui_draw_buffer_chat (buffer, 0);
/*else
gui_display_line (buffer, buffer->last_line, 1);*/
}
if (buffer->num_displayed > 0)
gui_draw_buffer_chat (buffer, 0);
if (buffer->num_displayed == 0)
{
if (3 - buffer->last_line->line_with_message -