From bbd4011020b1887fde10054c65fc9914b6350b18 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 15 Mar 2005 21:15:36 +0000 Subject: Added nicks count for channel buffers --- src/gui/curses/gui-display.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/gui/curses') diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index cf86fe86c..ecee45c4a 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -1027,8 +1027,8 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) { t_gui_window *ptr_win; t_weechat_hotlist *ptr_hotlist; - char format_more[32], *string; - int i, first_mode; + char format_more[32], str_nicks[32], *string; + int i, first_mode, x; /* make gcc happy */ (void) buffer; @@ -1262,20 +1262,39 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) } } - /* display "-MORE-" if last line is not displayed */ - gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE); + /* display "-MORE-" (if last line is not displayed) & nicks count */ + if (gui_buffer_has_nicklist (ptr_win->buffer)) + { + snprintf (str_nicks, sizeof (str_nicks) - 1, "%d", CHANNEL(ptr_win->buffer)->nicks_count); + x = ptr_win->win_width - strlen (str_nicks) - 4; + } + else + x = ptr_win->win_width; string = weechat_convert_encoding (cfg_look_charset_decode, (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? cfg_look_charset_internal : local_charset, _("-MORE-")); + x -= strlen (string) - 1; + if (x < 0) + x = 0; + gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE); if (ptr_win->sub_lines > 0) - mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7, - "%s", string); + mvwprintw (ptr_win->win_status, 0, x, "%s", string); else { - snprintf (format_more, 32, "%%-%ds", strlen (string)); - mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7, - format_more, " "); + snprintf (format_more, sizeof (format_more) - 1, "%%-%ds", strlen (string)); + mvwprintw (ptr_win->win_status, 0, x, format_more, " "); + } + if (gui_buffer_has_nicklist (ptr_win->buffer)) + { + gui_window_set_color (ptr_win->win_status, + COLOR_WIN_STATUS_DELIMITERS); + wprintw (ptr_win->win_status, " ["); + gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); + wprintw (ptr_win->win_status, "%s", str_nicks); + gui_window_set_color (ptr_win->win_status, + COLOR_WIN_STATUS_DELIMITERS); + wprintw (ptr_win->win_status, "]"); } free (string); -- cgit v1.2.3