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

Diff for /src/usr.bin/tmux/tty.c between version 1.13 and 1.14

version 1.13, 2009/07/22 18:02:23 version 1.14, 2009/07/22 20:53:38
Line 38 
Line 38 
 void    tty_attributes_fg(struct tty *, const struct grid_cell *);  void    tty_attributes_fg(struct tty *, const struct grid_cell *);
 void    tty_attributes_bg(struct tty *, const struct grid_cell *);  void    tty_attributes_bg(struct tty *, const struct grid_cell *);
   
   void    tty_redraw_region(struct tty *, struct tty_ctx *);
 void    tty_emulate_repeat(  void    tty_emulate_repeat(
             struct tty *, enum tty_code_code, enum tty_code_code, u_int);              struct tty *, enum tty_code_code, enum tty_code_code, u_int);
 void     tty_cell(struct tty *,  void    tty_cell(struct tty *,
                      const struct grid_cell *, const struct grid_utf8 *);              const struct grid_cell *, const struct grid_utf8 *);
   
 void  void
 tty_init(struct tty *tty, char *path, char *term)  tty_init(struct tty *tty, char *path, char *term)
Line 449 
Line 450 
  * width of the terminal.   * width of the terminal.
  */   */
 void  void
 tty_redraw_region(struct tty *tty, struct window_pane *wp)  tty_redraw_region(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i;          struct screen           *s = wp->screen;
           u_int                    i;
   
         /*          /*
          * If region is >= 50% of the screen, just schedule a window redraw. In           * If region is >= 50% of the screen, just schedule a window redraw. In
Line 460 
Line 462 
          * without this, the entire pane ends up being redrawn many times which           * without this, the entire pane ends up being redrawn many times which
          * can be much more data.           * can be much more data.
          */           */
         if (s->old_rupper - s->old_rlower >= screen_size_y(s) / 2) {          if (ctx->orupper - ctx->orlower >= screen_size_y(s) / 2) {
                 wp->flags |= PANE_REDRAW;                  wp->flags |= PANE_REDRAW;
                 return;                  return;
         }          }
   
         if (s->old_cy < s->old_rupper || s->old_cy > s->old_rlower) {          if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) {
                 for (i = s->old_cy; i < screen_size_y(s); i++)                  for (i = ctx->ocy; i < screen_size_y(s); i++)
                         tty_draw_line(tty, s, i, wp->xoff, wp->yoff);                          tty_draw_line(tty, s, i, wp->xoff, wp->yoff);
         } else {          } else {
                 for (i = s->old_rupper; i <= s->old_rlower; i++)                  for (i = ctx->orupper; i <= ctx->orlower; i++)
                         tty_draw_line(tty, s, i, wp->xoff, wp->yoff);                          tty_draw_line(tty, s, i, wp->xoff, wp->yoff);
         }          }
 }  }
Line 522 
Line 524 
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx) {          if (wp->xoff != 0 || screen_size_x(s) < tty->sx) {
                 tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff);                  tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);
                 return;                  return;
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
         if (tty_term_has(tty->term, TTYC_ICH) ||          if (tty_term_has(tty->term, TTYC_ICH) ||
             tty_term_has(tty->term, TTYC_ICH1))              tty_term_has(tty->term, TTYC_ICH1))
                 tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);                  tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
Line 547 
Line 549 
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx) {          if (wp->xoff != 0 || screen_size_x(s) < tty->sx) {
                 tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff);                  tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);
                 return;                  return;
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
         tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ctx->num);          tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ctx->num);
 }  }
   
Line 565 
Line 567 
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
                 tty_redraw_region(tty, wp);                  tty_redraw_region(tty, ctx);
                 return;                  return;
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);          tty_region(tty, ctx->orupper, ctx->orlower, wp->yoff);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
         tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);          tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);
 }  }
   
Line 585 
Line 587 
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
                 tty_redraw_region(tty, wp);                  tty_redraw_region(tty, ctx);
                 return;                  return;
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);          tty_region(tty, ctx->orupper, ctx->orlower, wp->yoff);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
         tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);          tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);
 }  }
   
Line 606 
Line 608 
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor(tty, 0, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, 0, ctx->ocy, wp->xoff, wp->yoff);
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
             tty_term_has(tty->term, TTYC_EL)) {              tty_term_has(tty->term, TTYC_EL)) {
                 tty_putcode(tty, TTYC_EL);                  tty_putcode(tty, TTYC_EL);
Line 625 
Line 627 
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
             tty_term_has(tty->term, TTYC_EL))              tty_term_has(tty->term, TTYC_EL))
                 tty_putcode(tty, TTYC_EL);                  tty_putcode(tty, TTYC_EL);
         else {          else {
                 for (i = s->old_cx; i < screen_size_x(s); i++)                  for (i = ctx->ocx; i < screen_size_x(s); i++)
                         tty_putc(tty, ' ');                          tty_putc(tty, ' ');
         }          }
 }  }
Line 639 
Line 641 
 tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx)  tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;  
         u_int                    i;          u_int                    i;
   
         tty_reset(tty);          tty_reset(tty);
   
         if (wp->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) {          if (wp->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) {
                 tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);                  tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
                 tty_putcode(tty, TTYC_EL1);                  tty_putcode(tty, TTYC_EL1);
         } else {          } else {
                 tty_cursor(tty, 0, s->old_cy, wp->xoff, wp->yoff);                  tty_cursor(tty, 0, ctx->ocy, wp->xoff, wp->yoff);
                 for (i = 0; i < s->old_cx + 1; i++)                  for (i = 0; i < ctx->ocx + 1; i++)
                         tty_putc(tty, ' ');                          tty_putc(tty, ' ');
         }          }
 }  }
Line 662 
Line 663 
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
                 tty_redraw_region(tty, wp);                  tty_redraw_region(tty, ctx);
                 return;                  return;
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);          tty_region(tty, ctx->orupper, ctx->orlower, wp->yoff);
   
         if (s->old_cy == s->old_rupper) {          if (ctx->ocy == ctx->orupper) {
                 tty_cursor(tty, s->old_cx, s->old_rupper, wp->xoff, wp->yoff);                  tty_cursor(tty, ctx->ocx, ctx->orupper, wp->xoff, wp->yoff);
                 tty_putcode(tty, TTYC_RI);                  tty_putcode(tty, TTYC_RI);
         }          }
 }  }
Line 684 
Line 685 
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
                 tty_redraw_region(tty, wp);                  tty_redraw_region(tty, ctx);
                 return;                  return;
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);          tty_region(tty, ctx->orupper, ctx->orlower, wp->yoff);
   
         if (s->old_cy == s->old_rlower) {          if (ctx->ocy == ctx->orlower) {
                 tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);                  tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
                 tty_putc(tty, '\n');                  tty_putc(tty, '\n');
         }          }
 }  }
Line 708 
Line 709 
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff);          tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff);
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
             tty_term_has(tty->term, TTYC_EL)) {              tty_term_has(tty->term, TTYC_EL)) {
                 tty_putcode(tty, TTYC_EL);                  tty_putcode(tty, TTYC_EL);
                 if (s->old_cy != screen_size_y(s) - 1) {                  if (ctx->ocy != screen_size_y(s) - 1) {
                         tty_cursor(tty, 0, s->old_cy + 1, wp->xoff, wp->yoff);                          tty_cursor(tty, 0, ctx->ocy + 1, wp->xoff, wp->yoff);
                         for (i = s->old_cy + 1; i < screen_size_y(s); i++) {                          for (i = ctx->ocy + 1; i < screen_size_y(s); i++) {
                                 tty_putcode(tty, TTYC_EL);                                  tty_putcode(tty, TTYC_EL);
                                 if (i == screen_size_y(s) - 1)                                  if (i == screen_size_y(s) - 1)
                                         continue;                                          continue;
Line 723 
Line 724 
                         }                          }
                 }                  }
         } else {          } else {
                 for (i = s->old_cx; i < screen_size_x(s); i++)                  for (i = ctx->ocx; i < screen_size_x(s); i++)
                         tty_putc(tty, ' ');                          tty_putc(tty, ' ');
                 for (j = s->old_cy; j < screen_size_y(s); j++) {                  for (j = ctx->ocy; j < screen_size_y(s); j++) {
                         tty_cursor(tty, 0, j, wp->xoff, wp->yoff);                          tty_cursor(tty, 0, j, wp->xoff, wp->yoff);
                         for (i = 0; i < screen_size_x(s); i++)                          for (i = 0; i < screen_size_x(s); i++)
                                 tty_putc(tty, ' ');                                  tty_putc(tty, ' ');
Line 746 
Line 747 
         tty_cursor(tty, 0, 0, wp->xoff, wp->yoff);          tty_cursor(tty, 0, 0, wp->xoff, wp->yoff);
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
             tty_term_has(tty->term, TTYC_EL)) {              tty_term_has(tty->term, TTYC_EL)) {
                 for (i = 0; i < s->old_cy; i++) {                  for (i = 0; i < ctx->ocy; i++) {
                         tty_putcode(tty, TTYC_EL);                          tty_putcode(tty, TTYC_EL);
                         tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);                          tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);
                         tty->cy++;                          tty->cy++;
                 }                  }
         } else {          } else {
                 for (j = 0; j < s->old_cy; j++) {                  for (j = 0; j < ctx->ocy; j++) {
                         tty_cursor(tty, 0, j, wp->xoff, wp->yoff);                          tty_cursor(tty, 0, j, wp->xoff, wp->yoff);
                         for (i = 0; i < screen_size_x(s); i++)                          for (i = 0; i < screen_size_x(s); i++)
                                 tty_putc(tty, ' ');                                  tty_putc(tty, ' ');
                 }                  }
         }          }
         for (i = 0; i <= s->old_cx; i++)          for (i = 0; i <= ctx->ocx; i++)
                 tty_putc(tty, ' ');                  tty_putc(tty, ' ');
 }  }
   
Line 813 
Line 814 
 tty_cmd_cell(struct tty *tty, struct tty_ctx *ctx)  tty_cmd_cell(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;  
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, ctx->ocx, ctx->ocy, wp->xoff, wp->yoff);
   
         tty_cell(tty, ctx->cell, ctx->utf8);          tty_cell(tty, ctx->cell, ctx->utf8);
 }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14