summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-02-08 00:14:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-02-08 00:14:39 +0000
commit357a13dd0465acb9e070b0363cdf8ae561ee396f (patch)
treea2aa68ff7d8ba67dfc17cd11dbf17dedc46fd828 /usr.bin
parentbebc96f43bcc836956b2128e9e27c8665dc594ca (diff)
Add an option to disable the smcup/rmcup alternate screen behaviour inside
tmux. From clemens fischer.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-set-option.c3
-rw-r--r--usr.bin/tmux/input.c8
-rw-r--r--usr.bin/tmux/tmux.117
-rw-r--r--usr.bin/tmux/tmux.c3
4 files changed, 26 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index c960ed27e4c..42ee6ae583e 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.33 2010/02/04 18:20:16 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.34 2010/02/08 00:14:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -138,6 +138,7 @@ const struct set_option_entry set_session_option_table[] = {
const struct set_option_entry set_window_option_table[] = {
{ "aggressive-resize", SET_OPTION_FLAG, 0, 0, NULL },
+ { "alternate-screen", SET_OPTION_FLAG, 0, 0, NULL },
{ "automatic-rename", SET_OPTION_FLAG, 0, 0, NULL },
{ "clock-mode-colour", SET_OPTION_COLOUR, 0, 0, NULL },
{ "clock-mode-style",
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 53b0c567705..70080438b58 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.26 2010/01/06 23:13:52 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.27 2010/02/08 00:14:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1148,6 +1148,7 @@ void
input_handle_sequence_sm(struct input_ctx *ictx)
{
struct window_pane *wp = ictx->wp;
+ struct options *oo = &wp->window->options;
struct screen *s = &wp->base;
u_int sx, sy;
uint16_t n;
@@ -1178,6 +1179,8 @@ input_handle_sequence_sm(struct input_ctx *ictx)
case 1049:
if (wp->saved_grid != NULL)
break;
+ if (!options_get_number(oo, "alternate-screen"))
+ break;
sx = screen_size_x(s);
sy = screen_size_y(s);
@@ -1224,6 +1227,7 @@ void
input_handle_sequence_rm(struct input_ctx *ictx)
{
struct window_pane *wp = ictx->wp;
+ struct options *oo = &wp->window->options;
struct screen *s = &wp->base;
u_int sx, sy;
uint16_t n;
@@ -1254,6 +1258,8 @@ input_handle_sequence_rm(struct input_ctx *ictx)
case 1049:
if (wp->saved_grid == NULL)
break;
+ if (!options_get_number(oo, "alternate-screen"))
+ break;
sx = screen_size_x(s);
sy = screen_size_y(s);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index f5275948efa..3e0a770da7e 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.149 2010/02/07 20:33:27 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.150 2010/02/08 00:14:38 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 7 2010 $
+.Dd $Mdocdate: February 8 2010 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -1898,6 +1898,19 @@ command.
Duplicate input to any pane to all other panes in the same window, except
for panes that are not in output mode.
.Pp
+.It Xo Ic alternate-screen
+.Op Ic on | off
+.Xc
+This option configures whether programs running inside
+.Nm
+may use the terminal alternate screen feature, which allows the
+.Em smcup
+and
+.Em rmcup
+.Xr terminfo 5
+capabilities to be issued to preserve the existing window content on start and
+restore it on exit.
+.Pp
.It Xo Ic utf8
.Op Ic on | off
.Xc
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index e79d2425e78..dd9549b121c 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.71 2010/02/06 18:47:41 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.72 2010/02/08 00:14:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -395,6 +395,7 @@ main(int argc, char **argv)
options_init(&global_w_options, NULL);
wo = &global_w_options;
options_set_number(wo, "aggressive-resize", 0);
+ options_set_number(wo, "alternate-screen", 1);
options_set_number(wo, "automatic-rename", 1);
options_set_number(wo, "clock-mode-colour", 4);
options_set_number(wo, "clock-mode-style", 1);