version 1.112, 2012/01/21 08:23:12 |
version 1.113, 2012/01/29 09:37:02 |
|
|
|
|
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); |
} |
} |
} |
} |
|
|
|
|
} |
} |
|
|
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. */ |
|
|
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); |
} |
} |
} |
} |
|
|
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; |
} |
} |
|
|
|
|
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 |
|
|
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; |
} |
} |
|
|
|
|
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); |
|
|
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); |
|
|
|
|
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 { |
|
|
|
|
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 { |
|
|
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 { |
|
|
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); |
|
|
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; |
|
|
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) { |
|
|
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); |
|
|
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); |
|
|
|
|
/* 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. |
|
|
* 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 |
|
|
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. */ |
|
|
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. */ |