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

Diff for /src/usr.bin/tmux/screen.c between version 1.61 and 1.62

version 1.61, 2020/04/15 12:59:20 version 1.62, 2020/04/15 17:50:02
Line 48 
Line 48 
 };  };
 TAILQ_HEAD(screen_titles, screen_title_entry);  TAILQ_HEAD(screen_titles, screen_title_entry);
   
 static void     screen_resize_y(struct screen *, u_int);  static void     screen_resize_y(struct screen *, u_int, int);
   static void     screen_reflow(struct screen *, u_int, u_int *, u_int *);
   
 static void     screen_reflow(struct screen *, u_int);  
   
 /* Free titles stack. */  /* Free titles stack. */
 static void  static void
 screen_free_titles(struct screen *s)  screen_free_titles(struct screen *s)
Line 216 
Line 215 
         }          }
 }  }
   
 /* Resize screen. */  /* Resize screen and return cursor position. */
 void  void
 screen_resize(struct screen *s, u_int sx, u_int sy, int reflow)  screen_resize_cursor(struct screen *s, u_int sx, u_int sy, int reflow,
       int eat_empty, u_int *cx, u_int *cy)
 {  {
           u_int   tcx, tcy;
   
           if (cx == NULL)
                   cx = &tcx;
           *cx = s->cx;
   
           if (cy == NULL)
                   cy = т
           *cy = s->grid->hsize + s->cy;
   
           log_debug("%s: start %u,%u (%u,%u)", __func__, s->cx, s->cy, *cx, *cy);
   
         if (sx < 1)          if (sx < 1)
                 sx = 1;                  sx = 1;
         if (sy < 1)          if (sy < 1)
Line 232 
Line 244 
                 reflow = 0;                  reflow = 0;
   
         if (sy != screen_size_y(s))          if (sy != screen_size_y(s))
                 screen_resize_y(s, sy);                  screen_resize_y(s, sy, eat_empty);
   
         if (reflow)          if (reflow)
                 screen_reflow(s, sx);                  screen_reflow(s, sx, cx, cy);
   
           if (*cy >= s->grid->hsize) {
                   s->cx = *cx;
                   s->cy = (*cy) - s->grid->hsize;
           } else {
                   s->cx = 0;
                   s->cy = 0;
           }
           log_debug("%s: finish %u,%u (%u,%u)", __func__, s->cx, s->cy, *cx, *cy);
 }  }
   
   /* Resize screen. */
   void
   screen_resize(struct screen *s, u_int sx, u_int sy, int reflow)
   {
           screen_resize_cursor(s, sx, sy, reflow, 1, NULL, NULL);
   }
   
 static void  static void
 screen_resize_y(struct screen *s, u_int sy)  screen_resize_y(struct screen *s, u_int sy, int eat_empty)
 {  {
         struct grid     *gd = s->grid;          struct grid     *gd = s->grid;
         u_int            needed, available, oldy, i;          u_int            needed, available, oldy, i;
Line 264 
Line 292 
                 needed = oldy - sy;                  needed = oldy - sy;
   
                 /* Delete as many lines as possible from the bottom. */                  /* Delete as many lines as possible from the bottom. */
                 available = oldy - 1 - s->cy;                  if (eat_empty) {
                 if (available > 0) {                          available = oldy - 1 - s->cy;
                         if (available > needed)                          if (available > 0) {
                                 available = needed;                                  if (available > needed)
                         grid_view_delete_lines(gd, oldy - available, available,                                          available = needed;
                             8);                                  grid_view_delete_lines(gd, oldy - available,
                                       available, 8);
                           }
                           needed -= available;
                 }                  }
                 needed -= available;  
   
                 /*                  /*
                  * Now just increase the history size, if possible, to take                   * Now just increase the history size, if possible, to take
Line 287 
Line 317 
                                 available = needed;                                  available = needed;
                         grid_view_delete_lines(gd, 0, available, 8);                          grid_view_delete_lines(gd, 0, available, 8);
                 }                  }
                 s->cy -= needed;  
         }          }
   
         /* Resize line array. */          /* Resize line array. */
Line 307 
Line 336 
                                 available = needed;                                  available = needed;
                         gd->hscrolled -= available;                          gd->hscrolled -= available;
                         gd->hsize -= available;                          gd->hsize -= available;
                         s->cy += available;  
                 } else                  } else
                         available = 0;                          available = 0;
                 needed -= available;                  needed -= available;
Line 482 
Line 510 
   
 /* Reflow wrapped lines. */  /* Reflow wrapped lines. */
 static void  static void
 screen_reflow(struct screen *s, u_int new_x)  screen_reflow(struct screen *s, u_int new_x, u_int *cx, u_int *cy)
 {  {
         u_int   cx = s->cx, cy = s->grid->hsize + s->cy, wx, wy;          u_int   wx, wy;
   
         grid_wrap_position(s->grid, cx, cy, &wx, &wy);          grid_wrap_position(s->grid, *cx, *cy, &wx, &wy);
         log_debug("%s: cursor %u,%u is %u,%u", __func__, cx, cy, wx, wy);          log_debug("%s: cursor %u,%u is %u,%u", __func__, *cx, *cy, wx, wy);
   
         grid_reflow(s->grid, new_x);          grid_reflow(s->grid, new_x);
   
         grid_unwrap_position(s->grid, &cx, &cy, wx, wy);          grid_unwrap_position(s->grid, cx, cy, wx, wy);
         log_debug("%s: new cursor is %u,%u", __func__, cx, cy);          log_debug("%s: new cursor is %u,%u", __func__, *cx,* cy);
   
         if (cy >= s->grid->hsize) {  
                 s->cx = cx;  
                 s->cy = cy - s->grid->hsize;  
         } else {  
                 s->cx = 0;  
                 s->cy = 0;  
         }  
 }  }
   
 /*  /*

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62