diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-10-23 10:16:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-10-23 10:16:15 +0000 |
commit | fdbae048113f7f555bbcb7926a3f623b8c8a6a47 (patch) | |
tree | 0eaaebc1e075d9450d1b60e29edc87bdf1c992f4 /usr.bin | |
parent | e3cfbeb71221f3f3bee3fcbfef00515742b2db32 (diff) |
Support for \e[3J to clear the history. Also send the corresponding
terminfo code (E3) before locking.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/input.c | 13 | ||||
-rw-r--r-- | usr.bin/tmux/screen-write.c | 13 | ||||
-rw-r--r-- | usr.bin/tmux/server-fn.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 | ||||
-rw-r--r-- | usr.bin/tmux/tty-term.c | 3 |
5 files changed, 31 insertions, 5 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index df0af355bcf..391c654344b 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.40 2011/07/08 06:28:05 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.41 2011/10/23 10:16:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1126,6 +1126,17 @@ input_csi_dispatch(struct input_ctx *ictx) case 2: screen_write_clearscreen(sctx); break; + case 3: + switch (input_get(ictx, 1, 0, 0)) { + case 0: + /* + * Linux console extension to clear history + * (for example before locking the screen). + */ + screen_write_clearhistory(sctx); + break; + } + break; default: log_debug("%s: unknown '%c'", __func__, ictx->ch); break; diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index f6cbe344910..f56c7460ac7 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.50 2011/05/18 20:24:29 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.51 2011/10/23 10:16:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -985,6 +985,17 @@ screen_write_clearscreen(struct screen_write_ctx *ctx) tty_write(tty_cmd_clearscreen, &ttyctx); } +/* Clear entire history. */ +void +screen_write_clearhistory(struct screen_write_ctx *ctx) +{ + struct screen *s = ctx->s; + struct grid *gd = s->grid; + + grid_move_lines(gd, 0, gd->hsize, gd->sy); + gd->hsize = 0; +} + /* Write cell data. */ void screen_write_cell(struct screen_write_ctx *ctx, diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 85cc7b88486..6b7da9af474 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.51 2011/09/05 23:40:51 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.52 2011/10/23 10:16:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -237,6 +237,7 @@ server_lock_client(struct client *c) tty_stop_tty(&c->tty); tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_SMCUP)); tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_CLEAR)); + tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_E3)); c->flags |= CLIENT_SUSPENDED; server_write_client(c, MSG_LOCK, &lockdata, sizeof lockdata); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 092ec0c8e69..ccaaaff925b 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.296 2011/10/23 08:34:01 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.297 2011/10/23 10:16:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -206,6 +206,7 @@ enum tty_code_code { TTYC_DIM, /* enter_dim_mode, mh */ TTYC_DL, /* parm_delete_line, DL */ TTYC_DL1, /* delete_line, dl */ + TTYC_E3, TTYC_EL, /* clr_eol, ce */ TTYC_EL1, /* clr_bol, cb */ TTYC_ENACS, /* ena_acs, eA */ @@ -1866,6 +1867,7 @@ void screen_write_kkeypadmode(struct screen_write_ctx *, int); void screen_write_clearendofscreen(struct screen_write_ctx *); void screen_write_clearstartofscreen(struct screen_write_ctx *); void screen_write_clearscreen(struct screen_write_ctx *); +void screen_write_clearhistory(struct screen_write_ctx *); void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *, const struct utf8_data *); void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int); diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index bca5681a236..c155fa5112a 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.25 2011/05/20 19:17:39 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.26 2011/10/23 10:16:14 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -61,6 +61,7 @@ const struct tty_term_code_entry tty_term_codes[NTTYCODE] = { { TTYC_DIM, TTYCODE_STRING, "dim" }, { TTYC_DL, TTYCODE_STRING, "dl" }, { TTYC_DL1, TTYCODE_STRING, "dl1" }, + { TTYC_E3, TTYCODE_STRING, "E3" }, { TTYC_EL, TTYCODE_STRING, "el" }, { TTYC_EL1, TTYCODE_STRING, "el1" }, { TTYC_ENACS, TTYCODE_STRING, "enacs" }, |