Fixed path width adaptation
This commit is contained in:
parent
b69768f6e8
commit
25ca57dfd7
1 changed files with 2 additions and 2 deletions
|
@ -1060,13 +1060,13 @@ sub render_cwd
|
||||||
|
|
||||||
my $cwd = $state->{cwd};
|
my $cwd = $state->{cwd};
|
||||||
( my $dir = $cwd ) =~ s!^.*/!!;
|
( my $dir = $cwd ) =~ s!^.*/!!;
|
||||||
|
my $max_len = int( $COLUMNS * $CONFIG{cwd_max_width} / 100 );
|
||||||
|
$max_len = length( $dir ) if length( $dir ) > $max_len;
|
||||||
if (exists $state->{home}) {
|
if (exists $state->{home}) {
|
||||||
my $home = $state->{home};
|
my $home = $state->{home};
|
||||||
( $dir = $cwd ) =~ s!^\Q$home\E(\z|/.*)$!~$1!;
|
( $dir = $cwd ) =~ s!^\Q$home\E(\z|/.*)$!~$1!;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $max_len = int( $COLUMNS * $CONFIG{cwd_max_width} / 100 );
|
|
||||||
$max_len = length( $dir ) if length( $dir ) > $max_len;
|
|
||||||
my $offset = length( $dir ) - $max_len;
|
my $offset = length( $dir ) - $max_len;
|
||||||
if ( $offset > 0 ) {
|
if ( $offset > 0 ) {
|
||||||
$dir = substr $dir , $offset , $max_len;
|
$dir = substr $dir , $offset , $max_len;
|
||||||
|
|
Loading…
Reference in a new issue