diff options
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 82 |
1 files changed, 41 insertions, 41 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.180 2009-12-04 22:05:52 tcunha Exp $ */ +/* $Id: tty.c,v 1.181 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -44,7 +44,7 @@ void tty_redraw_region(struct tty *, const struct tty_ctx *); void tty_emulate_repeat( struct tty *, enum tty_code_code, enum tty_code_code, u_int); void tty_cell(struct tty *, - const struct grid_cell *, const struct grid_utf8 *); + const struct grid_cell *, const struct grid_utf8 *); void tty_init(struct tty *tty, int fd, char *term) @@ -507,7 +507,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy) if (screen_check_selection(s, i, py)) { memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc); tmpgc.data = gc->data; - tmpgc.flags = gc->flags & + tmpgc.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256); tmpgc.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); @@ -567,7 +567,7 @@ tty_write(void (*cmdfn)( void 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; u_int i; @@ -578,12 +578,12 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) 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) || tty_term_has(tty->term, TTYC_ICH1)) 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_putcode(tty, TTYC_SMIR); for (i = 0; i < ctx->num; i++) @@ -596,7 +596,7 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) void 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; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || @@ -608,7 +608,7 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) 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) || tty_term_has(tty->term, TTYC_DCH1)) @@ -618,11 +618,11 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) void 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; - if (wp->xoff != 0 || screen_size_x(s) < tty->sx || - !tty_term_has(tty->term, TTYC_CSR) || + if (wp->xoff != 0 || screen_size_x(s) < tty->sx || + !tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_IL1)) { tty_redraw_region(tty, ctx); return; @@ -630,8 +630,8 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx) tty_reset(tty); - tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); - tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num); } @@ -639,10 +639,10 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx) void 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; - 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_DL1)) { tty_redraw_region(tty, ctx); @@ -651,8 +651,8 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx) tty_reset(tty); - tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); - tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num); } @@ -660,13 +660,13 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx) void 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; u_int i; 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 && tty_term_has(tty->term, TTYC_EL)) { @@ -680,7 +680,7 @@ tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx) void 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; u_int i; @@ -700,7 +700,7 @@ tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx) void 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; tty_reset(tty); @@ -718,13 +718,13 @@ tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx) void 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; if (ctx->ocy != ctx->orupper) 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_RI)) { tty_redraw_region(tty, ctx); @@ -732,23 +732,23 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx) } tty_reset(tty); - + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper); - + tty_putcode(tty, TTYC_RI); } void 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; if (ctx->ocy != ctx->orlower) 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_redraw_region(tty, ctx); return; @@ -763,17 +763,17 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) return; tty_reset(tty); - + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); - + tty_putc(tty, '\n'); } void 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; u_int i, j; @@ -809,7 +809,7 @@ tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx) void 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; u_int i, j; @@ -839,7 +839,7 @@ tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx) void 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; u_int i, j; @@ -926,7 +926,7 @@ tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx) * Cannot rely on not being a partial character, so just redraw the * 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 @@ -985,7 +985,7 @@ void tty_region_pane( 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); } @@ -1021,7 +1021,7 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower) void 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); } @@ -1033,7 +1033,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) struct tty_term *term = tty->term; u_int thisx, thisy; int change; - + if (cx > tty->sx - 1) cx = tty->sx - 1; @@ -1108,7 +1108,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) */ /* One above. */ - if (thisy != tty->rupper && + if (thisy != tty->rupper && cy == thisy - 1 && tty_term_has(term, TTYC_CUU1)) { tty_putcode(tty, TTYC_CUU1); goto out; @@ -1125,8 +1125,8 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) change = thisy - cy; /* +ve up, -ve down */ /* - * Try to use VPA if change is larger than absolute or if this change - * would cross the scroll region, otherwise use CUU/CUD. + * Try to use VPA if change is larger than absolute or if this + * change would cross the scroll region, otherwise use CUU/CUD. */ if (abs(change) > cy || (change < 0 && cy - change > tty->rlower) || @@ -1270,7 +1270,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, u_char *attr) } if (bg_default && bg != tc->bg && !(tc->flags & GRID_FLAG_BG256)) { - if (have_ax) + if (have_ax) tty_puts(tty, "\033[49m"); else if (tc->bg != 0) tty_putcode1(tty, TTYC_SETAB, 0); @@ -1320,7 +1320,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr) /* Otherwise set the foreground colour. */ tty_putcode1(tty, TTYC_SETAF, fg); -save_fg: +save_fg: /* Save the new values in the terminal current cell. */ tc->fg = fg; tc->flags &= ~GRID_FLAG_FG256; |