Ticket #152: fix-terminfo.patch

File fix-terminfo.patch, 1.1 KB (added by josephpiche, 4 years ago)

A better patch that actually fixes the terminfo code

  • utils/gg_utils.c

    old new  
    7575 
    7676/* terminfo attributes */ 
    7777static char *setaf;             /* terminfo string to set color */ 
    78 static int max_color;           /* terminfo max colour */ 
     78static char *op;                /* terminfo string to reset colors */ 
    7979 
    8080static int init = 0; 
    8181 
     
    103103 */ 
    104104 
    105105  static char setaf_literal[] = "setaf"; 
    106   static char colors_literal[] = "colors"; 
     106  static char op_literal[] = "op"; 
    107107  static char empty_literal[] = ""; 
    108108 
    109109  if (init) 
     
    115115  setaf = tigetstr(setaf_literal); 
    116116  if (!setaf) 
    117117    setaf = empty_literal; 
    118   max_color = tigetnum(colors_literal) - 1; 
    119   if (max_color < 1) 
    120     max_color = 1; 
    121   else if (max_color > 30) 
    122     max_color = 30; 
    123    
     118  op = tigetstr(op_literal); 
     119  if (!op) 
     120    op = empty_literal; 
     121  
    124122#endif /* TERMINFO */ 
    125123} 
    126124 
     
    157155#ifdef TERMINFO 
    158156 
    159157  fprintf(stderr, "%s%c", tparm(setaf, c, 0, 0, 0, 0, 0, 0, 0, 0), x); 
    160   fputs(tparm(setaf, max_color, 0, 0, 0, 0, 0, 0, 0, 0), stderr); 
     158  fputs(tparm(op, 0, 0, 0, 0, 0, 0, 0, 0, 0), stderr); 
    161159 
    162160#elif defined(ANSI_COLOR) 
    163161