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

Diff for /src/usr.bin/tmux/grid-reader.c between version 1.3 and 1.4

version 1.3, 2021/03/09 08:24:09 version 1.4, 2021/04/05 08:43:48
Line 71 
Line 71 
   
 /* Move cursor back one position. */  /* Move cursor back one position. */
 void  void
 grid_reader_cursor_left(struct grid_reader *gr)  grid_reader_cursor_left(struct grid_reader *gr, int wrap)
 {  {
         struct grid_cell        gc;          struct grid_cell        gc;
   
Line 81 
Line 81 
                         break;                          break;
                 gr->cx--;                  gr->cx--;
         }          }
         if (gr->cx == 0 && gr->cy > 0) {          if (gr->cx == 0 && gr->cy > 0 &&
               (wrap ||
                grid_get_line(gr->gd, gr->cy - 1)->flags & GRID_LINE_WRAPPED)) {
                 grid_reader_cursor_up(gr);                  grid_reader_cursor_up(gr);
                 grid_reader_cursor_end_of_line(gr, 0, 0);                  grid_reader_cursor_end_of_line(gr, 0, 0);
         } else if (gr->cx > 0)          } else if (gr->cx > 0)
Line 362 
Line 364 
                 xx = grid_line_length(gr->gd, py - 2);                  xx = grid_line_length(gr->gd, py - 2);
         }          }
         return 0;          return 0;
   }
   
   /* Jump back to the first non-blank character of the line. */
   void
   grid_reader_cursor_back_to_indentation(struct grid_reader *gr)
   {
           struct grid_cell        gc;
           u_int                   px, py, xx, yy;
   
           yy = gr->gd->hsize + gr->gd->sy - 1;
           grid_reader_cursor_start_of_line(gr, 1);
   
           for (py = gr->cy; py <= yy; py++) {
                   xx = grid_line_length(gr->gd, py);
                   for (px = 0; px < xx; px++) {
                           grid_get_cell(gr->gd, px, py, &gc);
                           if (gc.data.size != 1 || *gc.data.data != ' ')
                                   break;
                   }
                   if (~grid_get_line(gr->gd, py)->flags & GRID_LINE_WRAPPED)
                           break;
           }
 }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4