[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.291 and 1.292

version 1.291, 2017/07/21 14:25:29 version 1.292, 2017/07/21 22:55:45
Line 882 
Line 882 
     struct screen *s, u_int py, u_int ox, u_int oy)      struct screen *s, u_int py, u_int ox, u_int oy)
 {  {
         struct grid_cell         gc, last;          struct grid_cell         gc, last;
         u_int                    i, j, sx, nx, width;          u_int                    i, j, ux, sx, nx, width;
         int                      flags, cleared = 0;          int                      flags, cleared = 0;
         char                     buf[512];          char                     buf[512];
         size_t                   len, old_len;          size_t                   len, old_len;
Line 903 
Line 903 
                 sx = s->grid->linedata[s->grid->hsize + py].cellsize;                  sx = s->grid->linedata[s->grid->hsize + py].cellsize;
         if (sx > tty->sx)          if (sx > tty->sx)
                 sx = tty->sx;                  sx = tty->sx;
           ux = 0;
   
         if (wp == NULL ||          if (wp == NULL ||
             py == 0 ||              py == 0 ||
Line 944 
Line 945 
                     (sizeof buf) - len < gc.data.size)) {                      (sizeof buf) - len < gc.data.size)) {
                         tty_attributes(tty, &last, wp);                          tty_attributes(tty, &last, wp);
                         tty_putn(tty, buf, len, width);                          tty_putn(tty, buf, len, width);
                           ux += width;
   
                         len = 0;                          len = 0;
                         width = 0;                          width = 0;
Line 966 
Line 968 
                                 for (j = 0; j < gc.data.size; j++)                                  for (j = 0; j < gc.data.size; j++)
                                         tty_putc(tty, gc.data.data[j]);                                          tty_putc(tty, gc.data.data[j]);
                         }                          }
                           ux += gc.data.width;
                 } else {                  } else {
                         memcpy(buf + len, gc.data.data, gc.data.size);                          memcpy(buf + len, gc.data.data, gc.data.size);
                         len += gc.data.size;                          len += gc.data.size;
Line 975 
Line 978 
         if (len != 0) {          if (len != 0) {
                 if (grid_cells_equal(&last, &grid_default_cell)) {                  if (grid_cells_equal(&last, &grid_default_cell)) {
                         old_len = len;                          old_len = len;
                         while (len > 0 && buf[len - 1] == ' ')                          while (len > 0 && buf[len - 1] == ' ') {
                                 len--;                                  len--;
                                   width--;
                           }
                         log_debug("%s: trimmed %zu spaces", __func__,                          log_debug("%s: trimmed %zu spaces", __func__,
                             old_len - len);                              old_len - len);
                 }                  }
                 if (len != 0) {                  if (len != 0) {
                         tty_attributes(tty, &last, wp);                          tty_attributes(tty, &last, wp);
                         tty_putn(tty, buf, len, width);                          tty_putn(tty, buf, len, width);
                           ux += width;
                 }                  }
         }          }
   
         nx = screen_size_x(s) - sx;          nx = screen_size_x(s) - ux;
         if (!cleared && sx < tty->sx && nx != 0) {          if (!cleared && ux < tty->sx && nx != 0) {
                 tty_default_attributes(tty, wp, 8);                  tty_default_attributes(tty, wp, 8);
                 tty_clear_line(tty, wp, oy + py, ox + sx, nx, 8);                  tty_clear_line(tty, wp, oy + py, ox + ux, nx, 8);
         }          }
   
         tty->flags = (tty->flags & ~TTY_NOCURSOR) | flags;          tty->flags = (tty->flags & ~TTY_NOCURSOR) | flags;

Legend:
Removed from v.1.291  
changed lines
  Added in v.1.292