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

Diff for /src/usr.bin/tmux/window-copy.c between version 1.85 and 1.86

version 1.85, 2012/11/27 14:42:56 version 1.86, 2013/01/18 02:16:21
Line 908 
Line 908 
     struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx)      struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx)
 {  {
         const struct grid_cell  *gc, *sgc;          const struct grid_cell  *gc, *sgc;
         const struct grid_utf8  *gu, *sgu;          struct utf8_data         ud, sud;
   
         gc = grid_peek_cell(gd, px, py);          gc = grid_peek_cell(gd, px, py);
           grid_cell_get(gc, &ud);
         sgc = grid_peek_cell(sgd, spx, 0);          sgc = grid_peek_cell(sgd, spx, 0);
           grid_cell_get(sgc, &sud);
   
         if ((gc->flags & GRID_FLAG_UTF8) != (sgc->flags & GRID_FLAG_UTF8))          if (ud.size != sud.size || ud.width != sud.width)
                 return (0);                  return (0);
           return (memcmp(ud.data, sud.data, ud.size) == 0);
         if (gc->flags & GRID_FLAG_UTF8) {  
                 gu = grid_peek_utf8(gd, px, py);  
                 sgu = grid_peek_utf8(sgd, spx, 0);  
                 if (grid_utf8_compare(gu, sgu))  
                         return (1);  
         } else {  
                 if (gc->data == sgc->data)  
                         return (1);  
         }  
         return (0);  
 }  }
   
 int  int
Line 1395 
Line 1387 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct grid                     *gd = data->backing->grid;          struct grid                     *gd = data->backing->grid;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
         const struct grid_utf8          *gu;  
         struct grid_line                *gl;          struct grid_line                *gl;
           struct utf8_data                 ud;
         u_int                            i, xx, wrapped = 0;          u_int                            i, xx, wrapped = 0;
         size_t                           size;  
   
         if (sx > ex)          if (sx > ex)
                 return;                  return;
Line 1426 
Line 1417 
                         gc = grid_peek_cell(gd, i, sy);                          gc = grid_peek_cell(gd, i, sy);
                         if (gc->flags & GRID_FLAG_PADDING)                          if (gc->flags & GRID_FLAG_PADDING)
                                 continue;                                  continue;
                         if (!(gc->flags & GRID_FLAG_UTF8)) {                          grid_cell_get(gc, &ud);
                                 *buf = xrealloc(*buf, 1, (*off) + 1);  
                                 (*buf)[(*off)++] = gc->data;                          *buf = xrealloc(*buf, 1, (*off) + ud.size);
                         } else {                          memcpy(*buf + *off, ud.data, ud.size);
                                 gu = grid_peek_utf8(gd, i, sy);                          *off += ud.size;
                                 size = grid_utf8_size(gu);  
                                 *buf = xrealloc(*buf, 1, (*off) + size);  
                                 *off += grid_utf8_copy(gu, *buf + *off, size);  
                         }  
                 }                  }
         }          }
   
Line 1464 
Line 1451 
 {  {
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
   
         gc = grid_peek_cell(data->backing->grid, px, py);          gc = grid_peek_cell(data->backing->grid, px, py);
         if (gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8))          grid_cell_get(gc, &ud);
           if (ud.size != 1 || gc->flags & GRID_FLAG_PADDING)
                 return (0);                  return (0);
         if (gc->data == 0x00 || gc->data == 0x7f)          if (*ud.data == 0x00 || *ud.data == 0x7f)
                 return (0);                  return (0);
         return (strchr(set, gc->data) != NULL);          return (strchr(set, *ud.data) != NULL);
 }  }
   
 u_int  u_int
Line 1479 
Line 1468 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *s = data->backing;          struct screen                   *s = data->backing;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
         u_int                            px;          u_int                            px;
   
         /*          /*
Line 1492 
Line 1482 
                 px = screen_size_x(s);                  px = screen_size_x(s);
         while (px > 0) {          while (px > 0) {
                 gc = grid_peek_cell(s->grid, px - 1, py);                  gc = grid_peek_cell(s->grid, px - 1, py);
                 if (gc->flags & GRID_FLAG_UTF8)                  grid_cell_get(gc, &ud);
                   if (ud.size != 1 || *ud.data != ' ')
                         break;                          break;
                 if (gc->data != ' ')  
                         break;  
                 px--;                  px--;
         }          }
         return (px);          return (px);
Line 1527 
Line 1516 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         u_int                            px, py, xx;          u_int                            px, py, xx;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
   
         px = 0;          px = 0;
         py = screen_hsize(data->backing) + data->cy - data->oy;          py = screen_hsize(data->backing) + data->cy - data->oy;
Line 1534 
Line 1524 
   
         while (px < xx) {          while (px < xx) {
                 gc = grid_peek_cell(data->backing->grid, px, py);                  gc = grid_peek_cell(data->backing->grid, px, py);
                 if (gc->flags & GRID_FLAG_UTF8)                  grid_cell_get(gc, &ud);
                   if (ud.size != 1 || *ud.data != ' ')
                         break;                          break;
                 if (gc->data != ' ')  
                         break;  
                 px++;                  px++;
         }          }
   
Line 1696 
Line 1685 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
         u_int                            px, py, xx;          u_int                            px, py, xx;
   
         px = data->cx + 1;          px = data->cx + 1;
Line 1704 
Line 1694 
   
         while (px < xx) {          while (px < xx) {
                 gc = grid_peek_cell(back_s->grid, px, py);                  gc = grid_peek_cell(back_s->grid, px, py);
                 if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0                  grid_cell_get(gc, &ud);
                     && gc->data == data->jumpchar) {                  if (!(gc->flags & GRID_FLAG_PADDING) &&
                       ud.size == 1 && *ud.data == data->jumpchar) {
                         window_copy_update_cursor(wp, px, data->cy);                          window_copy_update_cursor(wp, px, data->cy);
                         if (window_copy_update_selection(wp))                          if (window_copy_update_selection(wp))
                                 window_copy_redraw_lines(wp, data->cy, 1);                                  window_copy_redraw_lines(wp, data->cy, 1);
Line 1722 
Line 1712 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
         u_int                            px, py;          u_int                            px, py;
   
         px = data->cx;          px = data->cx;
Line 1732 
Line 1723 
   
         for (;;) {          for (;;) {
                 gc = grid_peek_cell(back_s->grid, px, py);                  gc = grid_peek_cell(back_s->grid, px, py);
                 if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0                  grid_cell_get(gc, &ud);
                     && gc->data == data->jumpchar) {                  if (!(gc->flags & GRID_FLAG_PADDING) &&
                       ud.size == 1 && *ud.data == data->jumpchar) {
                         window_copy_update_cursor(wp, px, data->cy);                          window_copy_update_cursor(wp, px, data->cy);
                         if (window_copy_update_selection(wp))                          if (window_copy_update_selection(wp))
                                 window_copy_redraw_lines(wp, data->cy, 1);                                  window_copy_redraw_lines(wp, data->cy, 1);
Line 1752 
Line 1743 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
         u_int                            px, py, xx;          u_int                            px, py, xx;
   
         px = data->cx + 1;          px = data->cx + 1;
Line 1760 
Line 1752 
   
         while (px < xx) {          while (px < xx) {
                 gc = grid_peek_cell(back_s->grid, px, py);                  gc = grid_peek_cell(back_s->grid, px, py);
                 if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0                  grid_cell_get(gc, &ud);
                     && gc->data == data->jumpchar) {                  if (!(gc->flags & GRID_FLAG_PADDING) &&
                       ud.size == 1 && *ud.data == data->jumpchar) {
                         window_copy_update_cursor(wp, px - 1, data->cy);                          window_copy_update_cursor(wp, px - 1, data->cy);
                         if (window_copy_update_selection(wp))                          if (window_copy_update_selection(wp))
                                 window_copy_redraw_lines(wp, data->cy, 1);                                  window_copy_redraw_lines(wp, data->cy, 1);
Line 1778 
Line 1770 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         const struct grid_cell          *gc;          const struct grid_cell          *gc;
           struct utf8_data                 ud;
         u_int                            px, py;          u_int                            px, py;
   
         px = data->cx;          px = data->cx;
Line 1788 
Line 1781 
   
         for (;;) {          for (;;) {
                 gc = grid_peek_cell(back_s->grid, px, py);                  gc = grid_peek_cell(back_s->grid, px, py);
                 if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0                  grid_cell_get(gc, &ud);
                     && gc->data == data->jumpchar) {                  if (!(gc->flags & GRID_FLAG_PADDING) &&
                       ud.size == 1 && *ud.data == data->jumpchar) {
                         window_copy_update_cursor(wp, px + 1, data->cy);                          window_copy_update_cursor(wp, px + 1, data->cy);
                         if (window_copy_update_selection(wp))                          if (window_copy_update_selection(wp))
                                 window_copy_redraw_lines(wp, data->cy, 1);                                  window_copy_redraw_lines(wp, data->cy, 1);

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86