[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.314 and 1.315

version 1.314, 2019/03/04 09:29:40 version 1.315, 2019/03/12 23:21:45
Line 1208 
Line 1208 
         u_int                    i, j, ux, sx, width;          u_int                    i, j, ux, sx, width;
         int                      flags, cleared = 0;          int                      flags, cleared = 0;
         char                     buf[512];          char                     buf[512];
         size_t                   len, old_len;          size_t                   len;
         u_int                    cellsize;          u_int                    cellsize;
   
         log_debug("%s: px=%u py=%u nx=%u atx=%u aty=%u", __func__,          log_debug("%s: px=%u py=%u nx=%u atx=%u aty=%u", __func__,
Line 1263 
Line 1263 
                         tty_putcode(tty, TTYC_EL1);                          tty_putcode(tty, TTYC_EL1);
                         cleared = 1;                          cleared = 1;
                 }                  }
                 if (px + sx != 0)  
                         tty_cursor(tty, atx, aty);  
         } else          } else
                 log_debug("%s: wrapped line %u", __func__, aty);                  log_debug("%s: wrapped line %u", __func__, aty);
   
Line 1281 
Line 1279 
                     gcp->attr != last.attr ||                      gcp->attr != last.attr ||
                     gcp->fg != last.fg ||                      gcp->fg != last.fg ||
                     gcp->bg != last.bg ||                      gcp->bg != last.bg ||
                     ux + width + gcp->data.width >= nx ||                      ux + width + gcp->data.width > nx ||
                     (sizeof buf) - len < gcp->data.size)) {                      (sizeof buf) - len < gcp->data.size)) {
                         tty_attributes(tty, &last, wp);                          if (last.flags & GRID_FLAG_CLEARED) {
                         tty_putn(tty, buf, len, width);                                  log_debug("%s: %zu cleared", __func__, len);
                                   tty_clear_line(tty, wp, aty, atx + ux, width,
                                       last.bg);
                           } else {
                                   tty_attributes(tty, &last, wp);
                                   tty_cursor(tty, atx + ux, aty);
                                   tty_putn(tty, buf, len, width);
                           }
                         ux += width;                          ux += width;
   
                         len = 0;                          len = 0;
Line 1297 
Line 1302 
                         memcpy(&last, gcp, sizeof last);                          memcpy(&last, gcp, sizeof last);
                 if (ux + gcp->data.width > nx) {                  if (ux + gcp->data.width > nx) {
                         tty_attributes(tty, &last, wp);                          tty_attributes(tty, &last, wp);
                           tty_cursor(tty, atx + ux, aty);
                         for (j = 0; j < gcp->data.width; j++) {                          for (j = 0; j < gcp->data.width; j++) {
                                 if (ux + j > nx)                                  if (ux + j > nx)
                                         break;                                          break;
Line 1305 
Line 1311 
                         }                          }
                 } else if (gcp->attr & GRID_ATTR_CHARSET) {                  } else if (gcp->attr & GRID_ATTR_CHARSET) {
                         tty_attributes(tty, &last, wp);                          tty_attributes(tty, &last, wp);
                           tty_cursor(tty, atx + ux, aty);
                         for (j = 0; j < gcp->data.size; j++)                          for (j = 0; j < gcp->data.size; j++)
                                 tty_putc(tty, gcp->data.data[j]);                                  tty_putc(tty, gcp->data.data[j]);
                         ux += gc.data.width;                          ux += gc.data.width;
Line 1314 
Line 1321 
                         width += gcp->data.width;                          width += gcp->data.width;
                 }                  }
         }          }
         if (len != 0) {          if (len != 0 && ((~last.flags & GRID_FLAG_CLEARED) || last.bg != 8)) {
                 if (grid_cells_equal(&last, &grid_default_cell)) {                  if (last.flags & GRID_FLAG_CLEARED) {
                         old_len = len;                          log_debug("%s: %zu cleared (end)", __func__, len);
                         while (len > 0 && buf[len - 1] == ' ') {                          tty_clear_line(tty, wp, aty, atx + ux, width, last.bg);
                                 len--;                  } else {
                                 width--;  
                         }  
                         log_debug("%s: trimmed %zu spaces", __func__,  
                             old_len - len);  
                 }  
                 if (len != 0) {  
                         tty_attributes(tty, &last, wp);                          tty_attributes(tty, &last, wp);
                           tty_cursor(tty, atx + ux, aty);
                         tty_putn(tty, buf, len, width);                          tty_putn(tty, buf, len, width);
                         ux += width;  
                 }                  }
                   ux += width;
         }          }
   
         if (!cleared && ux < nx) {          if (!cleared && ux < nx) {
                   log_debug("%s: %u to end of line (%zu cleared)", __func__,
                       nx - ux, len);
                 tty_default_attributes(tty, wp, 8);                  tty_default_attributes(tty, wp, 8);
                 tty_clear_line(tty, wp, aty, atx + ux, nx - ux, 8);                  tty_clear_line(tty, wp, aty, atx + ux, nx - ux, 8);
         }          }

Legend:
Removed from v.1.314  
changed lines
  Added in v.1.315