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

Diff for /src/usr.bin/tmux/screen-write.c between version 1.105 and 1.106

version 1.105, 2017/02/06 19:26:49 version 1.106, 2017/02/08 08:50:10
Line 25 
Line 25 
   
 static void     screen_write_initctx(struct screen_write_ctx *,  static void     screen_write_initctx(struct screen_write_ctx *,
                     struct tty_ctx *);                      struct tty_ctx *);
 static void     screen_write_save_last(struct screen_write_ctx *,  
                     struct tty_ctx *);  
 static void     screen_write_flush(struct screen_write_ctx *);  static void     screen_write_flush(struct screen_write_ctx *);
   
 static int      screen_write_overwrite(struct screen_write_ctx *,  static int      screen_write_overwrite(struct screen_write_ctx *,
Line 437 
Line 435 
         ttyctx->orupper = s->rupper;          ttyctx->orupper = s->rupper;
 }  }
   
 /* Save last cell on screen. */  
 static void  
 screen_write_save_last(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx)  
 {  
         struct screen           *s = ctx->s;  
         struct grid             *gd = s->grid;  
         struct grid_cell         gc;  
         u_int                    xx;  
   
         memcpy(&gc, &grid_default_cell, sizeof gc);  
         for (xx = 1; xx <= screen_size_x(s); xx++) {  
                 grid_view_get_cell(gd, screen_size_x(s) - xx, s->cy, &gc);  
                 if (~gc.flags & GRID_FLAG_PADDING)  
                         break;  
         }  
         memcpy(&ttyctx->last_cell, &gc, sizeof ttyctx->last_cell);  
 }  
   
 /* Set a mode. */  /* Set a mode. */
 void  void
 screen_write_mode_set(struct screen_write_ctx *ctx, int mode)  screen_write_mode_set(struct screen_write_ctx *ctx, int mode)
Line 1040 
Line 1020 
         struct grid_line        *gl;          struct grid_line        *gl;
         struct grid_cell         tmp_gc, now_gc;          struct grid_cell         tmp_gc, now_gc;
         struct grid_cell_entry  *gce;          struct grid_cell_entry  *gce;
         int                      insert, skip, selected, wrapped = 0;          int                      insert, skip, selected;
   
         ctx->cells++;          ctx->cells++;
   
Line 1071 
Line 1051 
                 return;                  return;
         }          }
   
         /* Initialise the redraw context. */  
         screen_write_initctx(ctx, &ttyctx);  
   
         /* If in insert mode, make space for the cells. */          /* If in insert mode, make space for the cells. */
         if (s->mode & MODE_INSERT) {          if (s->mode & MODE_INSERT) {
                 if (s->cx <= sx - width) {                  if (s->cx <= sx - width) {
Line 1088 
Line 1065 
   
         /* Check this will fit on the current line and wrap if not. */          /* Check this will fit on the current line and wrap if not. */
         if ((s->mode & MODE_WRAP) && s->cx > sx - width) {          if ((s->mode & MODE_WRAP) && s->cx > sx - width) {
                 screen_write_flush(ctx);  
                 screen_write_save_last(ctx, &ttyctx);  
                 screen_write_linefeed(ctx, 1);                  screen_write_linefeed(ctx, 1);
                 s->cx = 0;      /* carriage return */                  s->cx = 0;      /* carriage return */
                 skip = 0;  
                 wrapped = 1;  
         }          }
   
         /* Sanity check cursor position. */          /* Sanity check cursor position. */
         if (s->cx > sx - width || s->cy > sy - 1)          if (s->cx > sx - width || s->cy > sy - 1)
                 return;                  return;
   
           /* Initialise the redraw context. */
           screen_write_initctx(ctx, &ttyctx);
   
         /* Handle overwriting of UTF-8 characters. */          /* Handle overwriting of UTF-8 characters. */
         gl = &s->grid->linedata[s->grid->hsize + s->cy];          gl = &s->grid->linedata[s->grid->hsize + s->cy];
         if (gl->flags & GRID_LINE_EXTENDED) {          if (gl->flags & GRID_LINE_EXTENDED) {
Line 1179 
Line 1155 
                 tty_write(tty_cmd_cell, &ttyctx);                  tty_write(tty_cmd_cell, &ttyctx);
                 ctx->written++;                  ctx->written++;
         } else if (!skip) {          } else if (!skip) {
                 if (wrapped) {                  /*
                         ttyctx.cell = gc;                   * If wp is NULL, we are not updating the terminal and don't
                         tty_write(tty_cmd_cell, &ttyctx);                   * care about actually writing the cells (tty_write will just
                         ctx->written++;                   * return). So don't even bother allocating the dirty array.
                 } else {                   */
                         /*                  if (ctx->wp != NULL && s->dirty == NULL) {
                          * If wp is NULL, we are not updating the terminal and                          log_debug("%s: allocating %u bits", __func__,
                          * don't care about actually writing the cells                              s->dirtysize);
                          * (tty_write will just return). So don't even bother                          s->dirty = bit_alloc(s->dirtysize);
                          * allocating the dirty array.                  }
                          */                  if (s->dirty != NULL) {
                         if (ctx->wp != NULL && s->dirty == NULL) {                          bit_set(s->dirty, screen_dirty_bit(s,
                                 log_debug("%s: allocating %u bits", __func__,                              ttyctx.ocx, ttyctx.ocy));
                                     s->dirtysize);                          ctx->dirty++;
                                 s->dirty = bit_alloc(s->dirtysize);  
                         }  
                         if (s->dirty != NULL) {  
                                 bit_set(s->dirty, screen_dirty_bit(s,  
                                     ttyctx.ocx, ttyctx.ocy));  
                                 ctx->dirty++;  
                         }  
                 }                  }
         } else          } else
                 ctx->skipped++;                  ctx->skipped++;

Legend:
Removed from v.1.105  
changed lines
  Added in v.1.106