diff options
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | screen-redraw.c | 20 | ||||
-rw-r--r-- | tmux.h | 3 | ||||
-rw-r--r-- | tty.c | 51 |
4 files changed, 42 insertions, 37 deletions
@@ -1,5 +1,8 @@ 27 March 2009 +* Clear using ED when redrawing the screen. I foolishly assumed using spaces + would be equivalent and terminals would pick up on this, but apparently not. + This fixes copy and paste in xterm/rxvt. * Sockets in /tmp are now created in a subdirectory named, tmux-UID, eg tmux-1000. The default socket is thus /tmp/tmux-UID/default. To start a separate server, the new -L command line option should be used: this creates @@ -1142,7 +1145,7 @@ (including mutt, emacs). No status bar yet and no key remapping or other customisation. -$Id: CHANGES,v 1.260 2009-03-27 15:57:09 nicm Exp $ +$Id: CHANGES,v 1.261 2009-03-28 10:15:01 nicm Exp $ LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms diff --git a/screen-redraw.c b/screen-redraw.c index 11147e02..d5099a31 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1,4 +1,4 @@ -/* $Id: screen-redraw.c,v 1.28 2009-03-27 16:44:51 nicm Exp $ */ +/* $Id: screen-redraw.c,v 1.29 2009-03-28 10:15:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -128,21 +128,5 @@ 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) { - 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); - } + tty_draw_line(&c->tty, s, py, oy); } @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.284 2009-03-27 17:04:04 nicm Exp $ */ +/* $Id: tmux.h,v 1.285 2009-03-28 10:15:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1065,6 +1065,7 @@ 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); @@ -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; } } |