[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.76 and 1.77

version 1.76, 2009/12/02 22:13:15 version 1.77, 2009/12/03 22:50:10
Line 44 
Line 44 
 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, int fd, char *term)  tty_init(struct tty *tty, int fd, char *term)
Line 502 
Line 502 
                 if (screen_check_selection(s, i, py)) {                  if (screen_check_selection(s, i, py)) {
                         memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);                          memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);
                         tmpgc.data = gc->data;                          tmpgc.data = gc->data;
                         tmpgc.flags = gc->flags &                          tmpgc.flags = gc->flags &
                             ~(GRID_FLAG_FG256|GRID_FLAG_BG256);                              ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
                         tmpgc.flags |= s->sel.cell.flags &                          tmpgc.flags |= s->sel.cell.flags &
                             (GRID_FLAG_FG256|GRID_FLAG_BG256);                              (GRID_FLAG_FG256|GRID_FLAG_BG256);
Line 562 
Line 562 
 void  void
 tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i;          u_int                    i;
   
Line 573 
Line 573 
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         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);
         else if (tty_term_has(tty->term, TTYC_SMIR) &&          else if (tty_term_has(tty->term, TTYC_SMIR) &&
             tty_term_has(tty->term, TTYC_RMIR)) {              tty_term_has(tty->term, TTYC_RMIR)) {
                 tty_putcode(tty, TTYC_SMIR);                  tty_putcode(tty, TTYC_SMIR);
                 for (i = 0; i < ctx->num; i++)                  for (i = 0; i < ctx->num; i++)
Line 591 
Line 591 
 void  void
 tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         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 (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
Line 603 
Line 603 
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         if (tty_term_has(tty->term, TTYC_DCH) ||          if (tty_term_has(tty->term, TTYC_DCH) ||
             tty_term_has(tty->term, TTYC_DCH1))              tty_term_has(tty->term, TTYC_DCH1))
Line 613 
Line 613 
 void  void
 tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         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 (wp->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);
                 return;                  return;
Line 625 
Line 625 
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);          tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);          tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);
 }  }
Line 634 
Line 634 
 void  void
 tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         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 (wp->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 646 
Line 646 
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);          tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);          tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);
 }  }
Line 655 
Line 655 
 void  void
 tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i;          u_int                    i;
   
         tty_reset(tty);          tty_reset(tty);
   
         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 (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
             tty_term_has(tty->term, TTYC_EL)) {              tty_term_has(tty->term, TTYC_EL)) {
Line 675 
Line 675 
 void  void
 tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i;          u_int                    i;
   
Line 695 
Line 695 
 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;          struct window_pane      *wp = ctx->wp;
         u_int                    i;          u_int                    i;
   
         tty_reset(tty);          tty_reset(tty);
Line 713 
Line 713 
 void  void
 tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (ctx->ocy != ctx->orupper)          if (ctx->ocy != ctx->orupper)
                 return;                  return;
   
         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_term_has(tty->term, TTYC_RI)) {              !tty_term_has(tty->term, TTYC_RI)) {
                 tty_redraw_region(tty, ctx);                  tty_redraw_region(tty, ctx);
Line 727 
Line 727 
         }          }
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);          tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
   
         tty_putcode(tty, TTYC_RI);          tty_putcode(tty, TTYC_RI);
 }  }
   
 void  void
 tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
   
         if (ctx->ocy != ctx->orlower)          if (ctx->ocy != ctx->orlower)
                 return;                  return;
   
         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, ctx);                  tty_redraw_region(tty, ctx);
                 return;                  return;
Line 758 
Line 758 
                 return;                  return;
   
         tty_reset(tty);          tty_reset(tty);
   
         tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);          tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
         tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);          tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
   
         tty_putc(tty, '\n');          tty_putc(tty, '\n');
 }  }
   
 void  void
 tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i, j;          u_int                    i, j;
   
Line 804 
Line 804 
 void  void
 tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i, j;          u_int                    i, j;
   
Line 834 
Line 834 
 void  void
 tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx)  tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx)
 {  {
         struct window_pane      *wp = ctx->wp;          struct window_pane      *wp = ctx->wp;
         struct screen           *s = wp->screen;          struct screen           *s = wp->screen;
         u_int                    i, j;          u_int                    i, j;
   
Line 921 
Line 921 
          * 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, wp->xoff, wp->yoff);
 }  }
   
 void  void
Line 980 
Line 980 
 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;          struct window_pane      *wp = ctx->wp;
   
         tty_region(tty, wp->yoff + rupper, wp->yoff + rlower);          tty_region(tty, wp->yoff + rupper, wp->yoff + rlower);
 }  }
Line 1016 
Line 1016 
 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;          struct window_pane      *wp = ctx->wp;
   
         tty_cursor(tty, wp->xoff + cx, wp->yoff + cy);          tty_cursor(tty, wp->xoff + cx, wp->yoff + cy);
 }  }
Line 1028 
Line 1028 
         struct tty_term *term = tty->term;          struct tty_term *term = tty->term;
         u_int            thisx, thisy;          u_int            thisx, thisy;
         int              change;          int              change;
   
         if (cx > tty->sx - 1)          if (cx > tty->sx - 1)
                 cx = tty->sx - 1;                  cx = tty->sx - 1;
   
Line 1103 
Line 1103 
                  */                   */
   
                 /* One above. */                  /* One above. */
                 if (thisy != tty->rupper &&                  if (thisy != tty->rupper &&
                     cy == thisy - 1 && tty_term_has(term, TTYC_CUU1)) {                      cy == thisy - 1 && tty_term_has(term, TTYC_CUU1)) {
                         tty_putcode(tty, TTYC_CUU1);                          tty_putcode(tty, TTYC_CUU1);
                         goto out;                          goto out;
Line 1120 
Line 1120 
                 change = thisy - cy;    /* +ve up, -ve down */                  change = thisy - cy;    /* +ve up, -ve down */
   
                 /*                  /*
                  * Try to use VPA if change is larger than absolute or if this change                   * Try to use VPA if change is larger than absolute or if this
                  * would cross the scroll region, otherwise use CUU/CUD.                   * change would cross the scroll region, otherwise use CUU/CUD.
                  */                   */
                 if (abs(change) > cy ||                  if (abs(change) > cy ||
                     (change < 0 && cy - change > tty->rlower) ||                      (change < 0 && cy - change > tty->rlower) ||
Line 1265 
Line 1265 
                         }                          }
                         if (bg_default &&                          if (bg_default &&
                             bg != tc->bg && !(tc->flags & GRID_FLAG_BG256)) {                              bg != tc->bg && !(tc->flags & GRID_FLAG_BG256)) {
                                 if (have_ax)                                  if (have_ax)
                                         tty_puts(tty, "\033[49m");                                          tty_puts(tty, "\033[49m");
                                 else if (tc->bg != 0)                                  else if (tc->bg != 0)
                                         tty_putcode1(tty, TTYC_SETAB, 0);                                          tty_putcode1(tty, TTYC_SETAB, 0);
Line 1315 
Line 1315 
         /* Otherwise set the foreground colour. */          /* Otherwise set the foreground colour. */
         tty_putcode1(tty, TTYC_SETAF, fg);          tty_putcode1(tty, TTYC_SETAF, fg);
   
 save_fg:  save_fg:
         /* Save the new values in the terminal current cell. */          /* Save the new values in the terminal current cell. */
         tc->fg = fg;          tc->fg = fg;
         tc->flags &= ~GRID_FLAG_FG256;          tc->flags &= ~GRID_FLAG_FG256;

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77