[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.311 and 1.312

version 1.311, 2021/01/18 11:14:24 version 1.312, 2021/01/22 10:21:24
Line 3981 
Line 3981 
         struct window_copy_mode_data    *data = wme->data;          struct window_copy_mode_data    *data = wme->data;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         struct grid_reader               gr;          struct grid_reader               gr;
         u_int                            px, py, cy, yy, ny, hsize;          u_int                            px, py, cy, oldy, yy, ny, nd, hsize;
   
         px = data->cx;          px = data->cx;
         hsize = screen_hsize(back_s);          hsize = screen_hsize(back_s);
         py = hsize + data->cy - data->oy;          py = hsize + data->cy - data->oy;
           oldy = data->cy;
   
         grid_reader_start(&gr, back_s->grid, px, py);          grid_reader_start(&gr, back_s->grid, px, py);
         grid_reader_cursor_start_of_line(&gr, 1);          grid_reader_cursor_start_of_line(&gr, 1);
Line 3996 
Line 3997 
         if (py < yy) {          if (py < yy) {
                 ny = yy - py;                  ny = yy - py;
                 cy = 0;                  cy = 0;
                   nd = 1;
         } else {          } else {
                 ny = 0;                  ny = 0;
                 cy = py - yy;                  cy = py - yy;
                   nd = oldy - cy + 1;
         }          }
         while (ny > 0) {          while (ny > 0) {
                 window_copy_cursor_up(wme, 1);                  window_copy_cursor_up(wme, 1);
Line 4006 
Line 4009 
         }          }
         window_copy_update_cursor(wme, px, cy);          window_copy_update_cursor(wme, px, cy);
         if (window_copy_update_selection(wme, 1, 0))          if (window_copy_update_selection(wme, 1, 0))
                 window_copy_redraw_lines(wme, data->cy, 1);                  window_copy_redraw_lines(wme, data->cy, nd);
 }  }
   
 static void  static void
Line 4038 
Line 4041 
         struct window_copy_mode_data    *data = wme->data;          struct window_copy_mode_data    *data = wme->data;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         struct grid_reader               gr;          struct grid_reader               gr;
         u_int                            px, py, cy, yy, ny, hsize;          u_int                            px, py, cy, oldy, yy, ny, nd, hsize;
   
         px = data->cx;          px = data->cx;
         hsize = screen_hsize(back_s);          hsize = screen_hsize(back_s);
         py =  hsize + data->cy - data->oy;          py =  hsize + data->cy - data->oy;
           oldy = data->cy;
   
         grid_reader_start(&gr, back_s->grid, px, py);          grid_reader_start(&gr, back_s->grid, px, py);
         if (data->screen.sel != NULL && data->rectflag)          if (data->screen.sel != NULL && data->rectflag)
Line 4054 
Line 4058 
         /* Scroll down if we went off the visible screen. */          /* Scroll down if we went off the visible screen. */
         cy = py - hsize + data->oy;          cy = py - hsize + data->oy;
         yy = screen_size_y(back_s) - 1;          yy = screen_size_y(back_s) - 1;
         if (cy > yy)          if (cy > yy) {
                 ny = cy - yy;                  ny = cy - yy;
         else                  oldy = yy;
                   nd = 1;
           } else {
                 ny = 0;                  ny = 0;
                   nd = cy - oldy + 1;
           }
         while (ny > 0) {          while (ny > 0) {
           window_copy_cursor_down(wme, 1);            window_copy_cursor_down(wme, 1);
           ny--;            ny--;
Line 4067 
Line 4075 
         else          else
                 window_copy_update_cursor(wme, px, cy);                  window_copy_update_cursor(wme, px, cy);
         if (window_copy_update_selection(wme, 1, 0))          if (window_copy_update_selection(wme, 1, 0))
                 window_copy_redraw_lines(wme, data->cy, 1);                  window_copy_redraw_lines(wme, oldy, nd);
 }  }
   
 static void  static void
Line 4433 
Line 4441 
 {  {
         struct window_copy_mode_data    *data = wme->data;          struct window_copy_mode_data    *data = wme->data;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         u_int                            px, py, xx, yy;          struct grid_reader               gr;
         int                              expected = 0;          u_int                            px, py, cy, oldy, yy, ny, nd, hsize;
   
         px = data->cx;          px = data->cx;
         py = screen_hsize(back_s) + data->cy - data->oy;          hsize = screen_hsize(back_s);
         xx = window_copy_find_length(wme, py);          py =  hsize + data->cy - data->oy;
         yy = screen_hsize(back_s) + screen_size_y(back_s) - 1;          oldy = data->cy;
   
         /*          grid_reader_start(&gr, back_s->grid, px, py);
          * First skip past any nonword characters and then any word characters.          grid_reader_cursor_next_word(&gr, separators);
          *          grid_reader_get_cursor(&gr, &px, &py);
          * expected is initially set to 0 for the former and then 1 for the  
          * latter.  
          */  
         do {  
                 while (px > xx ||  
                     window_copy_in_set(wme, px, py, separators) == expected) {  
                         /* Move down if we're past the end of the line. */  
                         if (px > xx) {  
                                 if (py == yy)  
                                         return;  
                                 window_copy_cursor_down(wme, 0);  
                                 px = 0;  
   
                                 py = screen_hsize(back_s) + data->cy - data->oy;          /* Scroll down if we went off the visible screen. */
                                 xx = window_copy_find_length(wme, py);          cy = py - hsize + data->oy;
                         } else          yy = screen_size_y(back_s) - 1;
                                 px++;          if (cy > yy) {
                 }                  ny = cy - yy;
                 expected = !expected;                  oldy = yy;
         } while (expected == 1);                  nd = 1;
           } else {
         window_copy_update_cursor(wme, px, data->cy);                  ny = 0;
                   nd = cy - oldy + 1;
           }
           while (ny > 0) {
             window_copy_cursor_down(wme, 1);
             ny--;
           }
           if (cy > yy)
                   window_copy_update_cursor(wme, px, yy);
           else
                   window_copy_update_cursor(wme, px, cy);
         if (window_copy_update_selection(wme, 1, 0))          if (window_copy_update_selection(wme, 1, 0))
                 window_copy_redraw_lines(wme, data->cy, 1);                  window_copy_redraw_lines(wme, oldy, nd);
 }  }
   
 static void  static void
Line 4528 
Line 4534 
         struct options                  *oo = wp->window->options;          struct options                  *oo = wp->window->options;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         struct grid_reader               gr;          struct grid_reader               gr;
         u_int                            px, py, cy, yy, ny, hsize;          u_int                            px, py, cy, oldy, yy, ny, nd, hsize;
         int                              keys;          int                              keys;
   
         px = data->cx;          px = data->cx;
         hsize = screen_hsize(back_s);          hsize = screen_hsize(back_s);
         py =  hsize + data->cy - data->oy;          py =  hsize + data->cy - data->oy;
           oldy = data->cy;
   
         grid_reader_start(&gr, back_s->grid, px, py);          grid_reader_start(&gr, back_s->grid, px, py);
         keys = options_get_number(oo, "mode-keys");          keys = options_get_number(oo, "mode-keys");
Line 4547 
Line 4554 
         /* Scroll down if we went off the visible screen. */          /* Scroll down if we went off the visible screen. */
         cy = py - hsize + data->oy;          cy = py - hsize + data->oy;
         yy = screen_size_y(back_s) - 1;          yy = screen_size_y(back_s) - 1;
         if (cy > yy)          if (cy > yy) {
                 ny = cy - yy;                  ny = cy - yy;
         else                  oldy = yy;
                   nd = 1;
           } else {
                 ny = 0;                  ny = 0;
                   nd = cy - oldy + 1;
           }
         while (ny > 0) {          while (ny > 0) {
           window_copy_cursor_down(wme, 1);            window_copy_cursor_down(wme, 1);
           ny--;            ny--;
Line 4560 
Line 4571 
         else          else
                 window_copy_update_cursor(wme, px, cy);                  window_copy_update_cursor(wme, px, cy);
         if (window_copy_update_selection(wme, 1, no_reset))          if (window_copy_update_selection(wme, 1, no_reset))
                 window_copy_redraw_lines(wme, data->cy, 1);                  window_copy_redraw_lines(wme, oldy, nd);
 }  }
   
 /* Compute the previous place where a word begins. */  /* Compute the previous place where a word begins. */
Line 4617 
Line 4628 
         struct window_copy_mode_data    *data = wme->data;          struct window_copy_mode_data    *data = wme->data;
         struct screen                   *back_s = data->backing;          struct screen                   *back_s = data->backing;
         struct grid_reader               gr;          struct grid_reader               gr;
         u_int                            px, py, cy, yy, ny, hsize;          u_int                            px, py, cy, oldy, yy, ny, nd, hsize;
   
         px = data->cx;          px = data->cx;
         hsize = screen_hsize(back_s);          hsize = screen_hsize(back_s);
         py = hsize + data->cy - data->oy;          py = hsize + data->cy - data->oy;
           oldy = data->cy;
   
         grid_reader_start(&gr, back_s->grid, px, py);          grid_reader_start(&gr, back_s->grid, px, py);
         grid_reader_cursor_previous_word(&gr, separators, already);          grid_reader_cursor_previous_word(&gr, separators, already);
Line 4632 
Line 4644 
         if (py < yy) {          if (py < yy) {
                 ny = yy - py;                  ny = yy - py;
                 cy = 0;                  cy = 0;
                   nd = 1;
         } else {          } else {
                 ny = 0;                  ny = 0;
                 cy = py - yy;                  cy = py - yy;
                   nd = oldy - cy + 1;
         }          }
         while (ny > 0) {          while (ny > 0) {
                 window_copy_cursor_up(wme, 1);                  window_copy_cursor_up(wme, 1);
Line 4642 
Line 4656 
         }          }
         window_copy_update_cursor(wme, px, cy);          window_copy_update_cursor(wme, px, cy);
         if (window_copy_update_selection(wme, 1, 0))          if (window_copy_update_selection(wme, 1, 0))
                 window_copy_redraw_lines(wme, data->cy, 1);                  window_copy_redraw_lines(wme, data->cy, nd);
 }  }
   
 static void  static void

Legend:
Removed from v.1.311  
changed lines
  Added in v.1.312