summaryrefslogtreecommitdiff
path: root/src/gui/curses/gui-curses-color.c
diff options
context:
space:
mode:
authorSimmo Saan <simmo.saan@gmail.com>2019-05-02 16:14:33 +0300
committerSimmo Saan <simmo.saan@gmail.com>2019-05-02 19:30:22 +0300
commitf5f6cf028cee227533aec86d1f4d189f6769f10c (patch)
treec6e779a23b926798d708787930c912b7209307d4 /src/gui/curses/gui-curses-color.c
parentd392b406c5a7aaae7a87a3e7eb4f71bd06fbc612 (diff)
downloadweechat-f5f6cf028cee227533aec86d1f4d189f6769f10c.zip
gui: change color buffer pairs table to only show allocated pairs (issue #1343)
Diffstat (limited to 'src/gui/curses/gui-curses-color.c')
-rw-r--r--src/gui/curses/gui-curses-color.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index 99a2ce518..a2e5e21f8 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -793,7 +793,7 @@ gui_color_info_term_colors (char *buffer, int size)
void
gui_color_buffer_display ()
{
- int y, i, lines, line, col, color, max_color, num_items;
+ int y, i, lines, columns, line, col, color, max_color, num_items;
char str_line[1024], str_color[64], str_rgb[64], **items;
struct t_gui_color_palette *color_palette;
@@ -830,17 +830,16 @@ gui_color_buffer_display ()
gui_color_pairs_used,
gui_color_num_pairs - gui_color_pairs_used);
}
+ columns = 16;
max_color = (gui_color_use_term_colors) ?
- gui_color_term_colors - 1 : gui_color_num_pairs;
- if (max_color > 255)
- max_color = 255;
- lines = (max_color <= 64) ? 8 : 16;
+ gui_color_term_colors - 1 : gui_color_pairs_used;
+ lines = (max_color + columns) / columns;
for (line = 0; line < lines; line++)
{
str_line[0] = '\0';
- for (col = 0; col < 16; col++)
+ for (col = 0; col < columns; col++)
{
- color = (col * lines) + line;
+ color = line * columns + col;
if (color <= max_color)
{
if (color == 0)
@@ -852,13 +851,11 @@ gui_color_buffer_display ()
|| (color <= gui_color_pairs_used))
{
snprintf (str_color, sizeof (str_color),
- "%c%c%05d%c%03d%c",
+ (color <= 999) ? "%c%c%05d %3d " : "%c%c%05d%5d",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_EXTENDED_CHAR,
color,
- (color == 0) ? '<' : ' ',
- color,
- (color == 0) ? '>' : ' ');
+ color);
}
else
{