diff options
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 51 |
1 files changed, 34 insertions, 17 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.82 2009-03-27 16:44:51 nicm Exp $ */ +/* $Id: tty.c,v 1.83 2009-03-28 10:15:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -32,7 +32,6 @@ 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 *); @@ -380,23 +379,41 @@ tty_emulate_repeat( } void -tty_draw_line(struct tty *tty, struct window_pane *wp, u_int py) +tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int oy) { - struct screen *s = wp->screen; - const struct grid_cell *gc; + const struct grid_cell *gc; struct grid_cell tc; - u_int i; + u_int i, sx; + + sx = screen_size_x(s); + if (sx > s->grid->size[s->grid->hsize + py]) + sx = s->grid->size[s->grid->hsize + py]; + if (sx > tty->sx) + sx = tty->sx; - for (i = 0; i < tty->sx; i++) { + for (i = 0; i < 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; - tty_cell(tty, &tc); - } else - tty_cell(tty, gc); + gc = &tc; + } + + tty_cursor(tty, i, py, oy); + tty_cell(tty, gc); + } + + if (sx >= tty->sx) + 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, ' '); } } @@ -469,10 +486,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, i); + tty_draw_line(tty, wp->screen, i, wp->yoff); } else { for (i = s->old_rupper; i <= s->old_rlower; i++) - tty_draw_line(tty, wp, i); + tty_draw_line(tty, wp->screen, i, wp->yoff); } return; } @@ -500,10 +517,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, i); + tty_draw_line(tty, wp->screen, i, wp->yoff); } else { for (i = s->old_rupper; i <= s->old_rlower; i++) - tty_draw_line(tty, wp, i); + tty_draw_line(tty, wp->screen, i, wp->yoff); } return; } @@ -585,7 +602,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, i); + tty_draw_line(tty, wp->screen, i, wp->yoff); } return; } @@ -613,7 +630,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, i); + tty_draw_line(tty, wp->screen, i, wp->yoff); return; } } |