summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-set-option.c1
-rw-r--r--input.c6
-rw-r--r--tmux.113
-rw-r--r--tmux.c1
4 files changed, 21 insertions, 0 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 63e646e0..6658b90b 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -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/input.c b/input.c
index cfa42406..bf31413c 100644
--- a/input.c
+++ b/input.c
@@ -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/tmux.1 b/tmux.1
index 377215eb..e01445e0 100644
--- a/tmux.1
+++ b/tmux.1
@@ -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/tmux.c b/tmux.c
index a582b951..8671e323 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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);