X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fformat_table.c;h=5fe7521af86f93760a67de3ecb4370f4c39df87e;hb=cbc0410d6223503a4deef0834d22a34f75e490e7;hp=b698cfdcc5638753e5727ab58a8df8a5c77dce67;hpb=8430b8de1df1b0732beab9534a7a91fc8c7b3c7d;p=vpp.git diff --git a/src/vppinfra/format_table.c b/src/vppinfra/format_table.c index b698cfdcc56..5fe7521af86 100644 --- a/src/vppinfra/format_table.c +++ b/src/vppinfra/format_table.c @@ -52,7 +52,7 @@ format_text_cell (table_t *t, u8 *s, table_cell_t *c, table_text_attr_t *def, { table_text_attr_t _a = {}, *a = &_a; - if (a == 0) + if (c == 0) return format (s, t->no_ansi ? "" : "\x1b[0m"); clib_memcpy (a, def, sizeof (table_text_attr_t)); @@ -64,12 +64,14 @@ format_text_cell (table_t *t, u8 *s, table_cell_t *c, table_text_attr_t *def, { a->fg_color = c->attr.fg_color; a->flags |= TTAF_FG_COLOR_SET; + a->flags |= c->attr.flags & TTAF_FG_COLOR_BRIGHT; } if (c->attr.flags & TTAF_BG_COLOR_SET) { a->bg_color = c->attr.bg_color; a->flags |= TTAF_BG_COLOR_SET; + a->flags |= c->attr.flags & TTAF_BG_COLOR_BRIGHT; } if (a->flags & TTAF_RESET) @@ -216,16 +218,24 @@ void table_set_cell_fg_color (table_t *t, int c, int r, table_text_attr_color_t v) { table_cell_t *cell = table_get_cell (t, c, r); - cell->attr.fg_color = v; + cell->attr.fg_color = v & 0x7; cell->attr.flags |= TTAF_FG_COLOR_SET; + if (v & 8) + cell->attr.flags |= TTAF_FG_COLOR_BRIGHT; + else + cell->attr.flags &= ~TTAF_FG_COLOR_BRIGHT; } void table_set_cell_bg_color (table_t *t, int c, int r, table_text_attr_color_t v) { table_cell_t *cell = table_get_cell (t, c, r); - cell->attr.bg_color = v; + cell->attr.bg_color = v & 0x7; cell->attr.flags |= TTAF_BG_COLOR_SET; + if (v & 8) + cell->attr.flags |= TTAF_BG_COLOR_BRIGHT; + else + cell->attr.flags &= ~TTAF_BG_COLOR_BRIGHT; } void