[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.269 and 1.270

version 1.269, 2020/04/09 14:30:28 version 1.270, 2020/04/10 07:44:26
Line 130 
Line 130 
 static void     window_copy_move_mouse(struct mouse_event *);  static void     window_copy_move_mouse(struct mouse_event *);
 static void     window_copy_drag_update(struct client *, struct mouse_event *);  static void     window_copy_drag_update(struct client *, struct mouse_event *);
 static void     window_copy_drag_release(struct client *, struct mouse_event *);  static void     window_copy_drag_release(struct client *, struct mouse_event *);
 static struct screen* window_copy_clone_screen(struct screen *src);  static struct screen* window_copy_clone_screen(struct screen *, struct screen*);
   
 const struct window_mode window_copy_mode = {  const struct window_mode window_copy_mode = {
         .name = "copy-mode",          .name = "copy-mode",
Line 299 
Line 299 
 }  }
   
 static struct screen *  static struct screen *
 window_copy_clone_screen(struct screen *src)  window_copy_clone_screen(struct screen *src, struct screen *hint)
 {  {
         struct screen                   *dst;          struct screen                   *dst;
         struct screen_write_ctx          ctx;          struct screen_write_ctx          ctx;
           u_int                            dy, sy;
   
         dst = xcalloc(1, sizeof *dst);          dst = xcalloc(1, sizeof *dst);
         screen_init(dst, screen_size_x(src),  
             screen_hsize(src) + screen_size_y(src), src->grid->hlimit);  
         grid_duplicate_lines(dst->grid, 0, src->grid, 0,  
             screen_hsize(src) + screen_size_y(src));  
         dst->grid->sy = screen_size_y(src);  
         dst->grid->hsize = screen_hsize(src);  
   
           sy = screen_hsize(src) + screen_size_y(src);
           if (screen_size_y(hint) > sy)
                   dy = screen_size_y(hint);
           else
                   dy = sy;
           screen_init(dst, screen_size_x(src), dy, src->grid->hlimit);
   
           grid_duplicate_lines(dst->grid, 0, src->grid, 0, sy);
           if (screen_size_y(hint) < sy) {
                   dst->grid->sy = screen_size_y(hint);
                   dst->grid->hsize = sy - screen_size_y(hint);
           }
   
         screen_write_start(&ctx, NULL, dst);          screen_write_start(&ctx, NULL, dst);
         screen_write_cursormove(&ctx, src->cx, src->cy, 0);          screen_write_cursormove(&ctx, 0, dst->grid->sy - 1, 0);
         screen_write_stop(&ctx);          screen_write_stop(&ctx);
   
         return (dst);          return (dst);
Line 361 
Line 369 
 window_copy_init(struct window_mode_entry *wme,  window_copy_init(struct window_mode_entry *wme,
     __unused struct cmd_find_state *fs, struct args *args)      __unused struct cmd_find_state *fs, struct args *args)
 {  {
         struct window_pane              *wp = wme->wp;          struct window_pane              *wp = wme->swp;
         struct window_copy_mode_data    *data;          struct window_copy_mode_data    *data;
         struct screen_write_ctx          ctx;          struct screen_write_ctx          ctx;
         u_int                            i;          u_int                            i;
   
         data = window_copy_common_init(wme);          data = window_copy_common_init(wme);
   
         data->backing = window_copy_clone_screen(&wp->base);          data->backing = window_copy_clone_screen(&wp->base, &data->screen);
         data->cx = data->backing->cx;          data->cx = data->backing->cx;
         data->cy = data->backing->cy;          data->cy = data->backing->cy;
   
Line 2001 
Line 2009 
 window_copy_cmd_refresh_from_pane(struct window_copy_cmd_state *cs)  window_copy_cmd_refresh_from_pane(struct window_copy_cmd_state *cs)
 {  {
         struct window_mode_entry        *wme = cs->wme;          struct window_mode_entry        *wme = cs->wme;
         struct window_pane              *wp = wme->wp;          struct window_pane              *wp = wme->swp;
         struct window_copy_mode_data    *data = wme->data;          struct window_copy_mode_data    *data = wme->data;
   
         if (data->viewmode)          if (data->viewmode)
Line 2009 
Line 2017 
   
         screen_free(data->backing);          screen_free(data->backing);
         free(data->backing);          free(data->backing);
         data->backing = window_copy_clone_screen(&wp->base);          data->backing = window_copy_clone_screen(&wp->base, &data->screen);
   
         return (WINDOW_COPY_CMD_REDRAW);          return (WINDOW_COPY_CMD_REDRAW);
 }  }
Line 2964 
Line 2972 
         struct grid_cell                 gc;          struct grid_cell                 gc;
         char                             hdr[512];          char                             hdr[512];
         size_t                           size = 0;          size_t                           size = 0;
           u_int                            hsize = screen_hsize(data->backing);
   
         style_apply(&gc, oo, "mode-style");          style_apply(&gc, oo, "mode-style");
         gc.flags |= GRID_FLAG_NOPALETTE;          gc.flags |= GRID_FLAG_NOPALETTE;
Line 2972 
Line 2981 
                 if (data->searchmark == NULL) {                  if (data->searchmark == NULL) {
                         if (data->timeout) {                          if (data->timeout) {
                                 size = xsnprintf(hdr, sizeof hdr,                                  size = xsnprintf(hdr, sizeof hdr,
                                         "(timed out) [%u/%u]", data->oy,                                      "(timed out) [%u/%u]", data->oy, hsize);
                                         screen_hsize(data->backing));  
                         } else {                          } else {
                                 size = xsnprintf(hdr, sizeof hdr,                                  size = xsnprintf(hdr, sizeof hdr,
                                         "[%u/%u]", data->oy,                                      "[%u/%u]", data->oy, hsize);
                                         screen_hsize(data->backing));  
                         }                          }
                 } else {                  } else {
                         if (data->searchthis == -1) {                          if (data->searchthis == -1) {
                                 size = xsnprintf(hdr, sizeof hdr,                                  size = xsnprintf(hdr, sizeof hdr,
                                     "(%u results) [%d/%u]", data->searchcount,                                      "(%u results) [%d/%u]", data->searchcount,
                                     data->oy, screen_hsize(data->backing));                                      data->oy, hsize);
                         } else {                          } else {
                                 size = xsnprintf(hdr, sizeof hdr,                                  size = xsnprintf(hdr, sizeof hdr,
                                     "(%u/%u results) [%d/%u]", data->searchthis,                                      "(%u/%u results) [%d/%u]", data->searchthis,
                                     data->searchcount, data->oy,                                      data->searchcount, data->oy, hsize);
                                     screen_hsize(data->backing));  
                         }                          }
                 }                  }
                 if (size > screen_size_x(s))                  if (size > screen_size_x(s))
Line 3000 
Line 3006 
   
         if (size < screen_size_x(s)) {          if (size < screen_size_x(s)) {
                 screen_write_cursormove(ctx, 0, py, 0);                  screen_write_cursormove(ctx, 0, py, 0);
                 screen_write_copy(ctx, data->backing, 0,                  screen_write_copy(ctx, data->backing, 0, hsize - data->oy + py,
                     (screen_hsize(data->backing) - data->oy) + py,  
                     screen_size_x(s) - size, 1, data->searchmark, &gc);                      screen_size_x(s) - size, 1, data->searchmark, &gc);
         }          }
   

Legend:
Removed from v.1.269  
changed lines
  Added in v.1.270