mirror of
https://github.com/duncs/clusterssh.git
synced 2025-04-21 09:09:06 +00:00
added "fillscreen" option
This commit is contained in:
parent
cd355f965d
commit
d1bc22ee22
4 changed files with 47 additions and 4 deletions
|
@ -989,10 +989,11 @@ sub retile_hosts {
|
|||
}
|
||||
$self->debug( 2, "Screen Columns: ", $self->config->{internal_columns} );
|
||||
$self->debug( 2, "Screen Rows: ", $self->config->{internal_rows} );
|
||||
$self->debug( 2, "Fill scree: ", $self->config->{fillscreen} );
|
||||
|
||||
# Now adjust the height of the terminal to either the max given,
|
||||
# or to get everything on screen
|
||||
{
|
||||
if ( $self->config->{fillscreen} ne 'yes' ) {
|
||||
my $height = int(
|
||||
( ( $self->config->{internal_screen_height}
|
||||
- $self->config->{screen_reserve_top}
|
||||
|
@ -1005,15 +1006,41 @@ sub retile_hosts {
|
|||
)
|
||||
) / $self->config->{internal_rows}
|
||||
);
|
||||
|
||||
$self->debug( 2, "Terminal height=$height" );
|
||||
|
||||
$self->config->{internal_terminal_height} = (
|
||||
$height > $self->config->{internal_terminal_height}
|
||||
? $self->config->{internal_terminal_height}
|
||||
: $height
|
||||
);
|
||||
}
|
||||
else {
|
||||
$self->config->{internal_terminal_height} = int(
|
||||
( ( $self->config->{internal_screen_height}
|
||||
- $self->config->{screen_reserve_top}
|
||||
- $self->config->{screen_reserve_bottom}
|
||||
) - (
|
||||
$self->config->{internal_rows} * (
|
||||
$self->config->{terminal_reserve_top}
|
||||
+ $self->config->{terminal_reserve_bottom}
|
||||
)
|
||||
)
|
||||
) / $self->config->{internal_rows}
|
||||
);
|
||||
$self->config->{internal_terminal_width} = int(
|
||||
( ( $self->config->{internal_screen_width}
|
||||
- $self->config->{screen_reserve_left}
|
||||
- $self->config->{screen_reserve_right}
|
||||
) - (
|
||||
$self->config->{internal_columns} * (
|
||||
$self->config->{terminal_reserve_left}
|
||||
+ $self->config->{terminal_reserve_right}
|
||||
)
|
||||
)
|
||||
) / $self->config->{internal_columns}
|
||||
);
|
||||
}
|
||||
$self->debug( 2, "Terminal h: ",
|
||||
$self->config->{internal_terminal_height},
|
||||
", w: ", $self->config->{internal_terminal_width} );
|
||||
|
||||
$self->config->dump("noexit") if ( $self->options->debug_level > 1 );
|
||||
|
||||
|
@ -2409,3 +2436,4 @@ See http://dev.perl.org/licenses/ for more information.
|
|||
=cut
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
@ -110,6 +110,9 @@ my %default_config = (
|
|||
user => '',
|
||||
rows => -1,
|
||||
cols => -1,
|
||||
|
||||
fillscreen => "no",
|
||||
|
||||
);
|
||||
|
||||
sub new {
|
||||
|
|
|
@ -250,6 +250,13 @@ sub add_common_options {
|
|||
arg_desc => 'rows',
|
||||
help => $self->loc('Number of rows'),
|
||||
);
|
||||
|
||||
$self->add_option(
|
||||
spec => 'fillscreen',
|
||||
help => $self->loc(
|
||||
'Resize terminal windows to fill the whole available screen'),
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
@ -395,6 +402,8 @@ sub getopts {
|
|||
if ( $self->cols ) {
|
||||
$self->parent->config->{cols} = $self->cols;
|
||||
}
|
||||
$self->parent->config->{fillscreen} = "yes"
|
||||
if ( $self->fillscreen );
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,8 @@ Readonly::Hash my %default_config => {
|
|||
user => '',
|
||||
rows => -1,
|
||||
cols => -1,
|
||||
|
||||
fillscreen => 'no',
|
||||
};
|
||||
my %expected = %default_config;
|
||||
is_deeply( $config, \%expected, 'default config is correct' );
|
||||
|
@ -547,6 +549,7 @@ console_position=
|
|||
external_cluster_command=
|
||||
extra_cluster_file=
|
||||
extra_tag_file=
|
||||
fillscreen=no
|
||||
hide_menu=0
|
||||
history_height=10
|
||||
history_width=40
|
||||
|
|
Loading…
Add table
Reference in a new issue