Sync OpenBSD patchset 642:

Add an option to disable the smcup/rmcup alternate screen behaviour inside
tmux. From clemens fischer.
This commit is contained in:
Tiago Cunha 2010-02-08 18:32:34 +00:00
parent c3c65c32a5
commit 10abdd97cf
4 changed files with 26 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-set-option.c,v 1.94 2010-02-05 01:31:06 tcunha Exp $ */ /* $Id: cmd-set-option.c,v 1.95 2010-02-08 18:32:34 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * 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[] = { const struct set_option_entry set_window_option_table[] = {
{ "aggressive-resize", SET_OPTION_FLAG, 0, 0, NULL }, { "aggressive-resize", SET_OPTION_FLAG, 0, 0, NULL },
{ "alternate-screen", SET_OPTION_FLAG, 0, 0, NULL },
{ "automatic-rename", 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-colour", SET_OPTION_COLOUR, 0, 0, NULL },
{ "clock-mode-style", { "clock-mode-style",

View File

@ -1,4 +1,4 @@
/* $Id: input.c,v 1.106 2010-01-08 16:22:02 tcunha Exp $ */ /* $Id: input.c,v 1.107 2010-02-08 18:32:34 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -1148,6 +1148,7 @@ void
input_handle_sequence_sm(struct input_ctx *ictx) input_handle_sequence_sm(struct input_ctx *ictx)
{ {
struct window_pane *wp = ictx->wp; struct window_pane *wp = ictx->wp;
struct options *oo = &wp->window->options;
struct screen *s = &wp->base; struct screen *s = &wp->base;
u_int sx, sy; u_int sx, sy;
uint16_t n; uint16_t n;
@ -1178,6 +1179,8 @@ input_handle_sequence_sm(struct input_ctx *ictx)
case 1049: case 1049:
if (wp->saved_grid != NULL) if (wp->saved_grid != NULL)
break; break;
if (!options_get_number(oo, "alternate-screen"))
break;
sx = screen_size_x(s); sx = screen_size_x(s);
sy = screen_size_y(s); sy = screen_size_y(s);
@ -1224,6 +1227,7 @@ void
input_handle_sequence_rm(struct input_ctx *ictx) input_handle_sequence_rm(struct input_ctx *ictx)
{ {
struct window_pane *wp = ictx->wp; struct window_pane *wp = ictx->wp;
struct options *oo = &wp->window->options;
struct screen *s = &wp->base; struct screen *s = &wp->base;
u_int sx, sy; u_int sx, sy;
uint16_t n; uint16_t n;
@ -1254,6 +1258,8 @@ input_handle_sequence_rm(struct input_ctx *ictx)
case 1049: case 1049:
if (wp->saved_grid == NULL) if (wp->saved_grid == NULL)
break; break;
if (!options_get_number(oo, "alternate-screen"))
break;
sx = screen_size_x(s); sx = screen_size_x(s);
sy = screen_size_y(s); sy = screen_size_y(s);

17
tmux.1
View File

@ -1,4 +1,4 @@
.\" $Id: tmux.1,v 1.231 2010-02-08 18:31:07 tcunha Exp $ .\" $Id: tmux.1,v 1.232 2010-02-08 18:32:34 tcunha Exp $
.\" .\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\" .\"
@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" 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 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@ -1898,6 +1898,19 @@ command.
Duplicate input to any pane to all other panes in the same window, except Duplicate input to any pane to all other panes in the same window, except
for panes that are not in output mode. for panes that are not in output mode.
.Pp .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 .It Xo Ic utf8
.Op Ic on | off .Op Ic on | off
.Xc .Xc

3
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.202 2010-02-08 18:25:04 tcunha Exp $ */ /* $Id: tmux.c,v 1.203 2010-02-08 18:32:34 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -398,6 +398,7 @@ main(int argc, char **argv)
options_init(&global_w_options, NULL); options_init(&global_w_options, NULL);
wo = &global_w_options; wo = &global_w_options;
options_set_number(wo, "aggressive-resize", 0); 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, "automatic-rename", 1);
options_set_number(wo, "clock-mode-colour", 4); options_set_number(wo, "clock-mode-colour", 4);
options_set_number(wo, "clock-mode-style", 1); options_set_number(wo, "clock-mode-style", 1);