~xzfc/libvterm/libvterm

« back to all changes in this revision

Viewing changes to t/harness.c

  • Committer: Albert Safin
  • Date: 2017-10-25 09:41:50 UTC
  • Revision ID: xzfcpw@gmail.com-20171025094150-wq78wsd1fwwiju4a
Export color indexes

Show diffs side-by-side

added added

removed removed

Lines of Context:
278
278
  int font;
279
279
  VTermColor foreground;
280
280
  VTermColor background;
 
281
  int foreground_index;
 
282
  int background_index;
281
283
} state_pen;
282
284
static int state_setpenattr(VTermAttr attr, VTermValue *val, void *user)
283
285
{
309
311
  case VTERM_ATTR_BACKGROUND:
310
312
    state_pen.background = val->color;
311
313
    break;
 
314
  case VTERM_ATTR_FOREGROUND_INDEX:
 
315
    state_pen.foreground_index = val->number;
 
316
    break;
 
317
  case VTERM_ATTR_BACKGROUND_INDEX:
 
318
    state_pen.background_index = val->number;
 
319
    break;
312
320
 
313
321
  case VTERM_N_ATTRS:
314
322
    return 0;
749
757
            printf("%d\n", state_pen.font);
750
758
        }
751
759
        else if(streq(linep, "foreground")) {
752
 
          printf("rgb(%d,%d,%d)\n", state_pen.foreground.red, state_pen.foreground.green, state_pen.foreground.blue);
 
760
          printf("%d:rgb(%d,%d,%d)\n", state_pen.foreground_index, state_pen.foreground.red, state_pen.foreground.green, state_pen.foreground.blue);
753
761
        }
754
762
        else if(streq(linep, "background")) {
755
 
          printf("rgb(%d,%d,%d)\n", state_pen.background.red, state_pen.background.green, state_pen.background.blue);
 
763
          printf("%d:rgb(%d,%d,%d)\n", state_pen.background_index, state_pen.background.red, state_pen.background.green, state_pen.background.blue);
756
764
        }
757
765
        else
758
766
          printf("?\n");
843
851
        printf("} ");
844
852
        if(cell.attrs.dwl)       printf("dwl ");
845
853
        if(cell.attrs.dhl)       printf("dhl-%s ", cell.attrs.dhl == 2 ? "bottom" : "top");
846
 
        printf("fg=rgb(%d,%d,%d) ",  cell.fg.red, cell.fg.green, cell.fg.blue);
847
 
        printf("bg=rgb(%d,%d,%d)\n", cell.bg.red, cell.bg.green, cell.bg.blue);
 
854
        printf("fg=%d:rgb(%d,%d,%d) ", cell.fg_index, cell.fg.red, cell.fg.green, cell.fg.blue);
 
855
        printf("bg=%d:rgb(%d,%d,%d)\n", cell.bg_index, cell.bg.red, cell.bg.green, cell.bg.blue);
848
856
      }
849
857
      else if(strstartswith(line, "?screen_eol ")) {
850
858
        char *linep = line + 12;