[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.11 and 1.12

version 1.11, 2009/07/22 15:55:32 version 1.12, 2009/07/22 16:45:31
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_cmd_alignmenttest(struct tty *, struct window_pane *, va_list);  void    tty_cmd_alignmenttest(struct tty *, struct tty_ctx *);
 void    tty_cmd_cell(struct tty *, struct window_pane *, va_list);  void    tty_cmd_cell(struct tty *, struct tty_ctx *);
 void    tty_cmd_clearendofline(struct tty *, struct window_pane *, va_list);  void    tty_cmd_clearendofline(struct tty *, struct tty_ctx *);
 void    tty_cmd_clearendofscreen(struct tty *, struct window_pane *, va_list);  void    tty_cmd_clearendofscreen(struct tty *, struct tty_ctx *);
 void    tty_cmd_clearline(struct tty *, struct window_pane *, va_list);  void    tty_cmd_clearline(struct tty *, struct tty_ctx *);
 void    tty_cmd_clearscreen(struct tty *, struct window_pane *, va_list);  void    tty_cmd_clearscreen(struct tty *, struct tty_ctx *);
 void    tty_cmd_clearstartofline(struct tty *, struct window_pane *, va_list);  void    tty_cmd_clearstartofline(struct tty *, struct tty_ctx *);
 void    tty_cmd_clearstartofscreen(struct tty *, struct window_pane *, va_list);  void    tty_cmd_clearstartofscreen(struct tty *, struct tty_ctx *);
 void    tty_cmd_deletecharacter(struct tty *, struct window_pane *, va_list);  void    tty_cmd_deletecharacter(struct tty *, struct tty_ctx *);
 void    tty_cmd_deleteline(struct tty *, struct window_pane *, va_list);  void    tty_cmd_deleteline(struct tty *, struct tty_ctx *);
 void    tty_cmd_insertcharacter(struct tty *, struct window_pane *, va_list);  void    tty_cmd_insertcharacter(struct tty *, struct tty_ctx *);
 void    tty_cmd_insertline(struct tty *, struct window_pane *, va_list);  void    tty_cmd_insertline(struct tty *, struct tty_ctx *);
 void    tty_cmd_linefeed(struct tty *, struct window_pane *, va_list);  void    tty_cmd_linefeed(struct tty *, struct tty_ctx *);
 void    tty_cmd_utf8character(struct tty *, struct window_pane *, va_list);  void    tty_cmd_utf8character(struct tty *, struct tty_ctx *);
 void    tty_cmd_reverseindex(struct tty *, struct window_pane *, va_list);  void    tty_cmd_reverseindex(struct tty *, struct tty_ctx *);
   
 void (*tty_cmds[])(struct tty *, struct window_pane *, va_list) = {  void (*tty_cmds[])(struct tty *, struct tty_ctx *) = {
         tty_cmd_alignmenttest,          tty_cmd_alignmenttest,
         tty_cmd_cell,          tty_cmd_cell,
         tty_cmd_clearendofline,          tty_cmd_clearendofline,
Line 545 
Line 545 
 }  }
   
 void  void
 tty_vwrite(  tty_write(struct tty *tty, enum tty_cmd cmd, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, enum tty_cmd cmd, va_list ap)  
 {  {
         if (tty->flags & TTY_FREEZE || tty->term == NULL)          if (tty->flags & TTY_FREEZE || tty->term == NULL)
                 return;                  return;
         if (tty_cmds[cmd] != NULL)          if (tty_cmds[cmd] != NULL)
                 tty_cmds[cmd](tty, wp, ap);                  tty_cmds[cmd](tty, ctx);
 }  }
   
 void  void
 tty_cmd_insertcharacter(struct tty *tty, struct window_pane *wp, va_list ap)  tty_cmd_insertcharacter(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            ua;          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, s->old_cy, wp->xoff, wp->yoff);
                 return;                  return;
         }          }
   
         ua = va_arg(ap, u_int);  
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, s->old_cx, s->old_cy, 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, ua);                  tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
         else {          else {
                 tty_putcode(tty, TTYC_SMIR);                  tty_putcode(tty, TTYC_SMIR);
                 while (ua-- > 0)                  while (ctx->num-- > 0)
                         tty_putc(tty, ' ');                          tty_putc(tty, ' ');
                 tty_putcode(tty, TTYC_RMIR);                  tty_putcode(tty, TTYC_RMIR);
         }          }
 }  }
   
 void  void
 tty_cmd_deletecharacter(struct tty *tty, struct window_pane *wp, va_list ap)  tty_cmd_deletecharacter(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            ua;          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, s->old_cy, wp->xoff, wp->yoff);
                 return;                  return;
         }          }
   
         ua = va_arg(ap, u_int);  
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);
         tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ua);          tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ctx->num);
 }  }
   
 void  void
 tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap)  tty_cmd_insertline(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            ua;          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_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
Line 612 
Line 607 
                 return;                  return;
         }          }
   
         ua = va_arg(ap, u_int);  
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);          tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);
         tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ua);          tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);
 }  }
   
 void  void
 tty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap)  tty_cmd_deleteline(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            ua;          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_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
Line 634 
Line 627 
                 return;                  return;
         }          }
   
         ua = va_arg(ap, u_int);  
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);          tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff);
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);
         tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ua);          tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);
 }  }
   
 void  void
 tty_cmd_clearline(struct tty *tty, struct window_pane *wp, unused va_list ap)  tty_cmd_clearline(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;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 663 
Line 655 
 }  }
   
 void  void
 tty_cmd_clearendofline(  tty_cmd_clearendofline(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, unused va_list ap)  
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i;          struct screen           *s = wp->screen;
           u_int                    i;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 682 
Line 674 
 }  }
   
 void  void
 tty_cmd_clearstartofline(  tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, unused va_list ap)  
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i;          struct screen           *s = wp->screen;
           u_int                    i;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 701 
Line 693 
 }  }
   
 void  void
 tty_cmd_reverseindex(struct tty *tty, struct window_pane *wp, unused va_list ap)  tty_cmd_reverseindex(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
           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_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
Line 722 
Line 715 
 }  }
   
 void  void
 tty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap)  tty_cmd_linefeed(struct tty *tty, struct tty_ctx *ctx)
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
           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_term_has(tty->term, TTYC_CSR)) {              !tty_term_has(tty->term, TTYC_CSR)) {
Line 743 
Line 737 
 }  }
   
 void  void
 tty_cmd_clearendofscreen(  tty_cmd_clearendofscreen(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, unused va_list ap)  
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i, j;          struct screen           *s = wp->screen;
           u_int                    i, j;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 778 
Line 772 
 }  }
   
 void  void
 tty_cmd_clearstartofscreen(  tty_cmd_clearstartofscreen(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, unused va_list ap)  
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i, j;          struct screen           *s = wp->screen;
           u_int                    i, j;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 807 
Line 801 
 }  }
   
 void  void
 tty_cmd_clearscreen(  tty_cmd_clearscreen(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, unused va_list ap)  
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i, j;          struct screen           *s = wp->screen;
           u_int                    i, j;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 836 
Line 830 
 }  }
   
 void  void
 tty_cmd_alignmenttest(  tty_cmd_alignmenttest(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, struct window_pane *wp, unused va_list ap)  
 {  {
         struct screen   *s = wp->screen;          struct window_pane      *wp = ctx->wp;
         u_int            i, j;          struct screen           *s = wp->screen;
           u_int                    i, j;
   
         tty_reset(tty);          tty_reset(tty);
   
Line 854 
Line 848 
 }  }
   
 void  void
 tty_cmd_cell(struct tty *tty, struct window_pane *wp, va_list ap)  tty_cmd_cell(struct tty *tty, struct tty_ctx *ctx)
 {  {
           struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         struct grid_cell        *gc;  
         struct grid_utf8        *gu;  
   
         gc = va_arg(ap, struct grid_cell *);  
         gu = va_arg(ap, struct grid_utf8 *);  
   
         tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);          tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff);
   
         tty_cell(tty, gc, gu);          tty_cell(tty, ctx->cell, ctx->utf8);
 }  }
   
 void  void
 tty_cmd_utf8character(  tty_cmd_utf8character(struct tty *tty, struct tty_ctx *ctx)
     struct tty *tty, unused struct window_pane *wp, va_list ap)  
 {  {
         u_char  *buf;          u_char  *ptr = ctx->ptr;
         size_t   i;          size_t   i;
   
         buf = va_arg(ap, u_char *);  
   
         for (i = 0; i < UTF8_SIZE; i++) {          for (i = 0; i < UTF8_SIZE; i++) {
                 if (buf[i] == 0xff)                  if (ptr[i] == 0xff)
                         break;                          break;
                 tty_putc(tty, buf[i]);                  tty_putc(tty, ptr[i]);
         }          }
 }  }
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12