[BACK]Return to tty.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/tty.c between version 1.174 and 1.175

version 1.174, 2015/04/15 22:10:13 version 1.175, 2015/04/15 22:34:46
Line 1453 
Line 1453 
 {  {
         u_int   colours;          u_int   colours;
   
           colours = tty_term_number(tty->term, TTYC_COLORS);
   
         /* Is this a 256-colour colour? */          /* Is this a 256-colour colour? */
         if (gc->flags & GRID_FLAG_FG256) {          if (gc->flags & GRID_FLAG_FG256) {
                 /* And not a 256 colour mode? */                  /* And not a 256 colour mode? */
Line 1461 
Line 1463 
                         gc->fg = colour_256to16(gc->fg);                          gc->fg = colour_256to16(gc->fg);
                         if (gc->fg & 8) {                          if (gc->fg & 8) {
                                 gc->fg &= 7;                                  gc->fg &= 7;
                                 gc->attr |= GRID_ATTR_BRIGHT;                                  if (colours >= 16)
                                           gc->fg += 90;
                                   else
                                           gc->attr |= GRID_ATTR_BRIGHT;
                         } else                          } else
                                 gc->attr &= ~GRID_ATTR_BRIGHT;                                  gc->attr &= ~GRID_ATTR_BRIGHT;
                         gc->flags &= ~GRID_FLAG_FG256;                          gc->flags &= ~GRID_FLAG_FG256;
Line 1470 
Line 1475 
         }          }
   
         /* Is this an aixterm colour? */          /* Is this an aixterm colour? */
         colours = tty_term_number(tty->term, TTYC_COLORS);  
         if (gc->fg >= 90 && gc->fg <= 97 && colours < 16) {          if (gc->fg >= 90 && gc->fg <= 97 && colours < 16) {
                 gc->fg -= 90;                  gc->fg -= 90;
                 gc->attr |= GRID_ATTR_BRIGHT;                  gc->attr |= GRID_ATTR_BRIGHT;
Line 1482 
Line 1486 
 {  {
         u_int   colours;          u_int   colours;
   
           colours = tty_term_number(tty->term, TTYC_COLORS);
   
         /* Is this a 256-colour colour? */          /* Is this a 256-colour colour? */
         if (gc->flags & GRID_FLAG_BG256) {          if (gc->flags & GRID_FLAG_BG256) {
                 /*                  /*
Line 1492 
Line 1498 
                 if (!(tty->term->flags & TERM_256COLOURS) &&                  if (!(tty->term->flags & TERM_256COLOURS) &&
                     !(tty->term_flags & TERM_256COLOURS)) {                      !(tty->term_flags & TERM_256COLOURS)) {
                         gc->bg = colour_256to16(gc->bg);                          gc->bg = colour_256to16(gc->bg);
                         if (gc->bg & 8)                          if (gc->bg & 8) {
                                 gc->bg &= 7;                                  gc->bg &= 7;
                         gc->attr &= ~GRID_ATTR_BRIGHT;                                  if (colours >= 16)
                                           gc->fg += 90;
                           }
                         gc->flags &= ~GRID_FLAG_BG256;                          gc->flags &= ~GRID_FLAG_BG256;
                 }                  }
                 return;                  return;
         }          }
   
         /* Is this an aixterm colour? */          /* Is this an aixterm colour? */
         colours = tty_term_number(tty->term, TTYC_COLORS);          if (gc->bg >= 90 && gc->bg <= 97 && colours < 16)
         if (gc->bg >= 90 && gc->bg <= 97 && colours < 16) {  
                 gc->bg -= 90;                  gc->bg -= 90;
                 gc->attr |= GRID_ATTR_BRIGHT;  
         }  
 }  }
   
 void  void
Line 1559 
Line 1564 
   
         /* Is this an aixterm bright colour? */          /* Is this an aixterm bright colour? */
         if (bg >= 90 && bg <= 97) {          if (bg >= 90 && bg <= 97) {
                 /* 16 colour terminals or above only. */                  xsnprintf(s, sizeof s, "\033[%dm", bg + 10);
                 if (tty_term_number(tty->term, TTYC_COLORS) >= 16) {                  tty_puts(tty, s);
                         xsnprintf(s, sizeof s, "\033[%dm", bg + 10);                  goto save_bg;
                         tty_puts(tty, s);  
                         goto save_bg;  
                 }  
                 bg -= 90;  
                 /* no such thing as a bold background */  
         }          }
   
         /* Otherwise set the background colour. */          /* Otherwise set the background colour. */

Legend:
Removed from v.1.174  
changed lines
  Added in v.1.175