Skip to content

Commit

Permalink
scripts/mosh: Add --no-init option to disable alternate screen mode
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Closes #384. Closes #2.
  • Loading branch information
andersk authored and keithw committed Mar 10, 2013
1 parent ed42d31 commit ea3ad78
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions man/mosh.1
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions scripts/mosh
Expand Up @@ -48,6 +48,8 @@ my $port_request = undef;

my $ssh = 'ssh';

my $term_init = 1;

my $help = undef;
my $version = undef;

Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
6 changes: 4 additions & 2 deletions src/terminal/terminaldisplayinit.cc
Expand Up @@ -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.