Whoops. Didn't mean to commit this yet.

pull/1/head
Nicholas Marriott 2009-03-27 16:44:51 +00:00
parent b97264bb70
commit f6001f9ffc
3 changed files with 36 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $Id: screen-redraw.c,v 1.27 2009-03-27 16:44:00 nicm Exp $ */
/* $Id: screen-redraw.c,v 1.28 2009-03-27 16:44:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -128,5 +128,21 @@ screen_redraw_blanky(struct client *c, u_int oy, u_int ny, char ch)
void
screen_redraw_line(struct client *c, struct screen *s, u_int oy, u_int py)
{
tty_draw_line(&c->tty, s, py, oy);
const struct grid_cell *gc;
struct grid_cell tc;
u_int i, sx;
sx = screen_size_x(s);
if (sx > c->tty.sx)
sx = c->tty.sx;
for (i = 0; i < sx; i++) {
gc = grid_view_peek_cell(s->grid, i, py);
tty_cursor(&c->tty, i, py, oy);
if (screen_check_selection(s, i, py)) {
memcpy(&tc, &s->sel.cell, sizeof tc);
tc.data = gc->data;
tty_cell(&c->tty, &tc);
} else
tty_cell(&c->tty, gc);
}
}

3
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.282 2009-03-27 16:44:00 nicm Exp $ */
/* $Id: tmux.h,v 1.283 2009-03-27 16:44:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -1065,7 +1065,6 @@ void tty_start_tty(struct tty *);
void tty_stop_tty(struct tty *);
void tty_set_title(struct tty *, const char *);
void tty_update_mode(struct tty *, int);
void tty_draw_line(struct tty *, struct screen *, u_int, u_int);
int tty_open(struct tty *, char **);
void tty_close(struct tty *, int);
void tty_free(struct tty *, int);

51
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.81 2009-03-27 16:44:00 nicm Exp $ */
/* $Id: tty.c,v 1.82 2009-03-27 16:44:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -32,6 +32,7 @@ u_char tty_get_acs(struct tty *, u_char);
void tty_emulate_repeat(
struct tty *, enum tty_code_code, enum tty_code_code, u_int);
void tty_draw_line(struct tty *, struct window_pane *, u_int);
void tty_raw(struct tty *, const char *);
@ -379,41 +380,23 @@ tty_emulate_repeat(
}
void
tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int oy)
tty_draw_line(struct tty *tty, struct window_pane *wp, u_int py)
{
const struct grid_cell *gc;
struct screen *s = wp->screen;
const struct grid_cell *gc;
struct grid_cell tc;
u_int i, sx;
u_int i;
sx = screen_size_x(s);
if (sx > tty->sx)
sx = tty->sx;
if (sx > s->grid->size[s->grid->hsize + py])
sx = s->grid->size[s->grid->hsize + py];
for (i = 0; i < sx; i++) {
for (i = 0; i < tty->sx; i++) {
gc = grid_view_peek_cell(s->grid, i, py);
tty_cursor(tty, i, py, wp->yoff);
if (screen_check_selection(s, i, py)) {
memcpy(&tc, &s->sel.cell, sizeof tc);
tc.data = gc->data;
gc = &tc;
}
tty_cursor(tty, i, py, oy);
tty_cell(tty, gc);
}
if (sx >= s->grid->size[s->grid->hsize + py])
return;
tty_reset(tty);
tty_cursor(tty, sx, py, oy);
if (tty_term_has(tty->term, TTYC_EL))
tty_putcode(tty, TTYC_EL);
else {
for (i = sx; i < screen_size_x(s); i++)
tty_putc(tty, ' ');
tty_cell(tty, &tc);
} else
tty_cell(tty, gc);
}
}
@ -486,10 +469,10 @@ tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap)
*/
if (s->old_cy < s->old_rupper || s->old_cy > s->old_rlower) {
for (i = s->old_cy; i < screen_size_y(s); i++)
tty_draw_line(tty, wp->screen, i, wp->yoff);
tty_draw_line(tty, wp, i);
} else {
for (i = s->old_rupper; i <= s->old_rlower; i++)
tty_draw_line(tty, wp->screen, i, wp->yoff);
tty_draw_line(tty, wp, i);
}
return;
}
@ -517,10 +500,10 @@ tty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap)
*/
if (s->old_cy < s->old_rupper || s->old_cy > s->old_rlower) {
for (i = s->old_cy; i < screen_size_y(s); i++)
tty_draw_line(tty, wp->screen, i, wp->yoff);
tty_draw_line(tty, wp, i);
} else {
for (i = s->old_rupper; i <= s->old_rlower; i++)
tty_draw_line(tty, wp->screen, i, wp->yoff);
tty_draw_line(tty, wp, i);
}
return;
}
@ -602,7 +585,7 @@ tty_cmd_reverseindex(struct tty *tty, struct window_pane *wp, unused va_list ap)
*/
if (s->old_cy == s->old_rupper) {
for (i = s->old_rupper; i <= s->old_rlower; i++)
tty_draw_line(tty, wp->screen, i, wp->yoff);
tty_draw_line(tty, wp, i);
}
return;
}
@ -630,7 +613,7 @@ tty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap)
*/
if (s->old_cy == s->old_rlower) {
for (i = s->old_rupper; i <= s->old_rlower; i++)
tty_draw_line(tty, wp->screen, i, wp->yoff);
tty_draw_line(tty, wp, i);
return;
}
}