[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.6 and 1.7

version 1.6, 2009/07/08 05:56:11 version 1.7, 2009/07/09 22:48:20
Line 122 
Line 122 
 screen_resize_x(struct screen *s, u_int sx)  screen_resize_x(struct screen *s, u_int sx)
 {  {
         struct grid             *gd = s->grid;          struct grid             *gd = s->grid;
         const struct grid_cell  *gc;  
         const struct grid_utf8  *gu;  
         u_int                    xx, yy;  
   
         if (sx == 0)          if (sx == 0)
                 fatalx("zero size");                  fatalx("zero size");
   
         /* If getting larger, not much to do. */          /*
         if (sx > screen_size_x(s)) {           * Treat resizing horizontally simply: just ensure the cursor is
                 gd->sx = sx;           * on-screen and change the size. Don't bother to truncate any lines -
                 return;           * then the data should be accessible if the size is then incrased.
         }           *
            * The only potential wrinkle is if UTF-8 double-width characters are
         /* If getting smaller, nuke any data in lines over the new size. */           * left in the last column, but UTF-8 terminals should deal with this
         for (yy = gd->hsize; yy < gd->hsize + screen_size_y(s); yy++) {           * sanely.
                 /*           */
                  * If the character after the last is wide or padding, remove  
                  * it and any leading padding.  
                  */  
                 gc = &grid_default_cell;  
                 for (xx = sx; xx > 0; xx--) {  
                         gc = grid_peek_cell(gd, xx - 1, yy);  
                         if (!(gc->flags & GRID_FLAG_PADDING))  
                                 break;  
                         grid_set_cell(gd, xx - 1, yy, &grid_default_cell);  
                 }  
                 if (xx > 0 && xx != sx && gc->flags & GRID_FLAG_UTF8) {  
                         gu = grid_peek_utf8(gd, xx - 1, yy);  
                         if (gu->width > 1) {  
                                 grid_set_cell(  
                                     gd, xx - 1, yy, &grid_default_cell);  
                         }  
                 }  
   
                 /* Reduce the line size. */  
                 grid_reduce_line(gd, yy, sx);  
         }  
   
         if (s->cx >= sx)          if (s->cx >= sx)
                 s->cx = sx - 1;                  s->cx = sx - 1;
         gd->sx = sx;          gd->sx = sx;

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7