summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-03-28 10:15:01 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-03-28 10:15:01 +0000
commit587badecdb4eed64835e076a589631ceda3bcae5 (patch)
tree5cb0555ac13737faca05ffa743c7a6b4c0d01333
parenta7f57773b7b3ec6ee1cb435fe393e0b87b6eb332 (diff)
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.
-rw-r--r--CHANGES5
-rw-r--r--screen-redraw.c20
-rw-r--r--tmux.h3
-rw-r--r--tty.c51
4 files changed, 42 insertions, 37 deletions
diff --git a/CHANGES b/CHANGES
index db0709f4..94f456b0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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);
}
diff --git a/tmux.h b/tmux.h
index 1945b2b4..9c7f9e28 100644
--- a/tmux.h
+++ b/tmux.h
@@ -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);
diff --git a/tty.c b/tty.c
index fa37d309..6e6f345c 100644
--- a/tty.c
+++ b/tty.c
@@ -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;
}
}