diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-01-04 14:37:14 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-01-04 14:37:14 +0100 |
commit | fb6033517610cb22ce1b8e6362c613a1d7e52587 (patch) | |
tree | 477176a00b0c781b2f5a5012dc5e9b87ae2891c3 /src | |
parent | a341d809b265c56342b6c516b0cc4674a7a70d08 (diff) | |
download | weechat-fb6033517610cb22ce1b8e6362c613a1d7e52587.zip |
Fix number of colors displayed in buffer opened by /color (can be different between WeeChat and terminal colors)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/curses/gui-curses-color.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index 7f8b6c22c..26c132f9b 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -349,14 +349,14 @@ gui_color_init_pairs () struct t_gui_color_palette *ptr_color_palette; /* - * depending on terminal and $TERM value, we can have for example: + * depending on $TERM value, we can have for example: * - * terminal | $TERM | colors | pairs - * ---------+-----------------+--------+------ - * urxvt | rxvt-unicode | 88 | 256 - * urxvt | xterm-256color | 256 | 32767 - * screen | screen | 8 | 64 - * screen | screen-256color | 256 | 32767 + * $TERM | colors | pairs + * ----------------------------------+--------+------ + * rxvt-unicode, xterm,... | 88 | 256 + * rxvt-256color, xterm-256color,... | 256 | 32767 + * screen | 8 | 64 + * screen-256color | 256 | 32767 */ if (has_colors ()) @@ -549,7 +549,7 @@ gui_color_display_terminal_colors () void gui_color_buffer_display () { - int y, i, lines, line, col, color; + int y, i, lines, line, col, color, max_color; int colors, color_pairs, change_color, num_items; char str_line[1024], str_color[64], str_rgb[64], **items; struct t_gui_color_palette *color_palette; @@ -597,14 +597,17 @@ gui_color_buffer_display () GUI_COLOR_PAIR_STR, GUI_COLOR(GUI_COLOR_CHAT), _("fixed color")); - lines = (colors < 16) ? colors : 16; + max_color = (gui_color_terminal_colors) ? colors - 1 : gui_color_last_pair; + if (max_color > 255) + max_color = 255; + lines = (max_color <= 64) ? 8 : 16; for (line = 0; line < lines; line++) { str_line[0] = '\0'; for (col = 0; col < 16; col++) { - color = (col * 16) + line + 1; - if (color < colors) + color = (col * lines) + line + 1; + if (color <= max_color) { snprintf (str_color, sizeof (str_color), "%s%s%05d %03d ", |