Permalink
Browse files

scripts/mosh: Add --no-init option to disable alternate screen mode

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Closes #384. Closes #2.
  • Loading branch information...
1 parent ed42d31 commit ea3ad786fa98f1ae75dd32845d0df9e1056f69e2 @andersk andersk committed with keithw Jan 28, 2013
Showing with 16 additions and 2 deletions.
  1. +6 −0 man/mosh.1
  2. +6 −0 scripts/mosh
  3. +4 −2 src/terminal/terminaldisplayinit.cc
View
@@ -128,6 +128,12 @@ only port that is forwarded through a firewall to the
server. Otherwise, \fBmosh\fP will choose a port between 60000 and
61000.
+.TP
+.B \-\-no\-init
+Do not send the \fBsmcup\fP initialization string and \fBrmcup\fP
+deinitialization string to the client's terminal. On many terminals
+this disables alternate screen mode.
+
.SH ESCAPE SEQUENCES
The escape sequence to shut down the connection is \fBCtrl-^ .\fP
View
@@ -48,6 +48,8 @@ my $port_request = undef;
my $ssh = 'ssh';
+my $term_init = 1;
+
my $help = undef;
my $version = undef;
@@ -72,6 +74,8 @@ qq{Usage: $0 [options] [--] [user@]host [command...]
(example: "ssh -p 2222")
(default: "ssh")
+ --no-init do not send terminal initialization string
+
--help this message
--version version and copyright information
@@ -104,6 +108,7 @@ GetOptions( 'client=s' => \$client,
'n' => sub { $predict = 'never' },
'p=s' => \$port_request,
'ssh=s' => \$ssh,
+ 'init!' => \$term_init,
'help' => \$help,
'version' => \$version,
'fake-proxy!' => \my $fake_proxy ) or die $usage;
@@ -281,6 +286,7 @@ if ( $pid == 0 ) { # child
# Now start real mosh client
$ENV{ 'MOSH_KEY' } = $key;
$ENV{ 'MOSH_PREDICTION_DISPLAY' } = $predict;
+ $ENV{ 'MOSH_NO_TERM_INIT' } = '1' if !$term_init;
exec {$client} ("$client @cmdline |", $ip, $port);
}
@@ -146,7 +146,9 @@ Display::Display( bool use_environment )
posterize_colors = ti_num( "colors" ) < 256;
*/
- smcup = ti_str("smcup");
- rmcup = ti_str("rmcup");
+ if ( !getenv( "MOSH_NO_TERM_INIT" ) ) {
+ smcup = ti_str("smcup");
+ rmcup = ti_str("rmcup");
+ }
}
}

0 comments on commit ea3ad78

Please sign in to comment.