[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.112 and 1.113

version 1.112, 2012/01/21 08:23:12 version 1.113, 2012/01/29 09:37:02
Line 513 
Line 513 
   
         if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) {          if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) {
                 for (i = ctx->ocy; 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, ctx->xoff, ctx->yoff);
         } else {          } else {
                 for (i = ctx->orupper; i <= ctx->orlower; 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, ctx->xoff, ctx->yoff);
         }          }
 }  }
   
Line 585 
Line 585 
 }  }
   
 void  void
 tty_write(void (*cmdfn)(  tty_write(
     struct tty *, const struct tty_ctx *), const struct tty_ctx *ctx)      void (*cmdfn)(struct tty *, const struct tty_ctx *), struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct client           *c;          struct client           *c;
           struct session          *s;
           struct options          *oo;
         u_int                    i;          u_int                    i;
   
         /* wp can be NULL if updating the screen but not the terminal. */          /* wp can be NULL if updating the screen but not the terminal. */
Line 607 
Line 609 
                         continue;                          continue;
                 if (c->flags & CLIENT_SUSPENDED)                  if (c->flags & CLIENT_SUSPENDED)
                         continue;                          continue;
                   s = c->session;
   
                 if (c->session->curw->window == wp->window) {                  if (s->curw->window == wp->window) {
                         if (c->tty.term == NULL)                          if (c->tty.term == NULL)
                                 continue;                                  continue;
                         if (c->tty.flags & (TTY_FREEZE|TTY_BACKOFF))                          if (c->tty.flags & (TTY_FREEZE|TTY_BACKOFF))
                                 continue;                                  continue;
                           oo = &s->options;
   
                           ctx->xoff = wp->xoff;
                           ctx->yoff = wp->yoff;
                           if (status_at_line(c) == 0)
                                   ctx->yoff++;
   
                         cmdfn(&c->tty, ctx);                          cmdfn(&c->tty, ctx);
                 }                  }
         }          }
Line 625 
Line 635 
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i;          u_int                    i;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx) {          if (ctx->xoff != 0 || screen_size_x(s) < tty->sx) {
                 tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);                  tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
                 return;                  return;
         }          }
   
Line 644 
Line 654 
                         tty_putc(tty, ' ');                          tty_putc(tty, ' ');
                 tty_putcode(tty, TTYC_RMIR);                  tty_putcode(tty, TTYC_RMIR);
         } else          } else
                 tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);                  tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
 }  }
   
 void  void
Line 653 
Line 663 
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (ctx->xoff != 0 || screen_size_x(s) < tty->sx ||
             (!tty_term_has(tty->term, TTYC_DCH) &&              (!tty_term_has(tty->term, TTYC_DCH) &&
             !tty_term_has(tty->term, TTYC_DCH1))) {              !tty_term_has(tty->term, TTYC_DCH1))) {
                 tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);                  tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
                 return;                  return;
         }          }
   
Line 675 
Line 685 
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (ctx->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR) ||              !tty_term_has(tty->term, TTYC_CSR) ||
             !tty_term_has(tty->term, TTYC_IL1)) {              !tty_term_has(tty->term, TTYC_IL1)) {
                 tty_redraw_region(tty, ctx);                  tty_redraw_region(tty, ctx);
Line 696 
Line 706 
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (ctx->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR) ||              !tty_term_has(tty->term, TTYC_CSR) ||
             !tty_term_has(tty->term, TTYC_DL1)) {              !tty_term_has(tty->term, TTYC_DL1)) {
                 tty_redraw_region(tty, ctx);                  tty_redraw_region(tty, ctx);
Line 722 
Line 732 
   
         tty_cursor_pane(tty, ctx, 0, ctx->ocy);          tty_cursor_pane(tty, ctx, 0, ctx->ocy);
   
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (ctx->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 {
Line 742 
Line 752 
   
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (ctx->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 {
Line 754 
Line 764 
 void  void
 tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          u_int    i;
         u_int                    i;  
   
         tty_reset(tty);          tty_reset(tty);
   
         if (wp->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) {          if (ctx->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) {
                 tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);                  tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
                 tty_putcode(tty, TTYC_EL1);                  tty_putcode(tty, TTYC_EL1);
         } else {          } else {
Line 778 
Line 787 
         if (ctx->ocy != ctx->orupper)          if (ctx->ocy != ctx->orupper)
                 return;                  return;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (ctx->xoff != 0 || screen_size_x(s) < tty->sx ||
             !tty_term_has(tty->term, TTYC_CSR) ||              !tty_term_has(tty->term, TTYC_CSR) ||
             !tty_term_has(tty->term, TTYC_RI)) {              !tty_term_has(tty->term, TTYC_RI)) {
                 tty_redraw_region(tty, ctx);                  tty_redraw_region(tty, ctx);
Line 802 
Line 811 
         if (ctx->ocy != ctx->orlower)          if (ctx->ocy != ctx->orlower)
                 return;                  return;
   
         if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||          if (ctx->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, ctx);                  tty_redraw_region(tty, ctx);
                 return;                  return;
Line 836 
Line 845 
         tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);          tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (ctx->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 (ctx->ocy != screen_size_y(s) - 1) {                  if (ctx->ocy != screen_size_y(s) - 1) {
Line 872 
Line 881 
         tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);          tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
         tty_cursor_pane(tty, ctx, 0, 0);          tty_cursor_pane(tty, ctx, 0, 0);
   
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (ctx->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 < ctx->ocy; i++) {                  for (i = 0; i < ctx->ocy; i++) {
                         tty_putcode(tty, TTYC_EL);                          tty_putcode(tty, TTYC_EL);
Line 902 
Line 911 
         tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);          tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
         tty_cursor_pane(tty, ctx, 0, 0);          tty_cursor_pane(tty, ctx, 0, 0);
   
         if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&          if (ctx->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 < screen_size_y(s); i++) {                  for (i = 0; i < screen_size_y(s); i++) {
                         tty_putcode(tty, TTYC_EL);                          tty_putcode(tty, TTYC_EL);
Line 957 
Line 966 
   
         /* Is the cursor in the very last position? */          /* Is the cursor in the very last position? */
         if (ctx->ocx > wp->sx - width) {          if (ctx->ocx > wp->sx - width) {
                 if (wp->xoff != 0 || wp->sx != tty->sx) {                  if (ctx->xoff != 0 || wp->sx != tty->sx) {
                         /*                          /*
                          * The pane doesn't fill the entire line, the linefeed                           * The pane doesn't fill the entire line, the linefeed
                          * will already have happened, so just move the cursor.                           * will already have happened, so just move the cursor.
Line 991 
Line 1000 
          * Cannot rely on not being a partial character, so just redraw the           * Cannot rely on not being a partial character, so just redraw the
          * whole line.           * whole line.
          */           */
         tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);          tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
 }  }
   
 void  void
Line 1078 
Line 1087 
 tty_region_pane(  tty_region_pane(
     struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower)      struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower)
 {  {
         struct window_pane      *wp = ctx->wp;          tty_region(tty, ctx->yoff + rupper, ctx->yoff + rlower);
   
         tty_region(tty, wp->yoff + rupper, wp->yoff + rlower);  
 }  }
   
 /* Set region at absolute position. */  /* Set region at absolute position. */
Line 1112 
Line 1119 
 void  void
 tty_cursor_pane(struct tty *tty, const struct tty_ctx *ctx, u_int cx, u_int cy)  tty_cursor_pane(struct tty *tty, const struct tty_ctx *ctx, u_int cx, u_int cy)
 {  {
         struct window_pane      *wp = ctx->wp;          tty_cursor(tty, ctx->xoff + cx, ctx->yoff + cy);
   
         tty_cursor(tty, wp->xoff + cx, wp->yoff + cy);  
 }  }
   
 /* Move cursor to absolute position. */  /* Move cursor to absolute position. */

Legend:
Removed from v.1.112  
changed lines
  Added in v.1.113