Merge branch 'dev'

This commit is contained in:
Emmanuel BENOîT 2020-10-23 13:20:51 +02:00
commit 75084eacac

View file

@ -363,7 +363,7 @@ sub gen_transition
my @colors = ( @_ , @{ themed 'transition' } ); my @colors = ( @_ , @{ themed 'transition' } );
my $state = 0; my $state = 0;
my $pc; my $pc;
my $out = [ ]; my $out = [ {style=>'none'} ];
foreach my $char ( split // , $transition ) { foreach my $char ( split // , $transition ) {
if ( $state == 1 ) { if ( $state == 1 ) {
if ( $char eq 'f' || $char eq 'b' ) { if ( $char eq 'f' || $char eq 'b' ) {
@ -783,24 +783,25 @@ sub render_userhost
} }
} }
my $str = ''; my @out = ();
if ( $un ) { if ( $un ) {
$str .= getpwuid( $< ) || '(?)'; push @out , ( getpwuid( $< ) || '(?)' );
} }
if ( $hn == 1 || ( $hn == 2 && $is_remote ) ) { if ( $hn == 1 || ( $hn == 2 && $is_remote ) ) {
$str .= '@' if $str; push @out , '@' if @out;
$str .= hostname; push @out , hostname;
} }
if ( $rm && $is_remote ) { if ( $rm && $is_remote ) {
$str .= themed 'uh_remote_symbol'; push @out , {style => 'b'};
push @out , ( themed 'uh_remote_symbol' );
} }
return () unless $str; return () unless @out;
return { return {
bg => themed( ( $> == 0 ) ? 'uh_root_bg' : 'uh_user_bg' ) , bg => themed( ( $> == 0 ) ? 'uh_root_bg' : 'uh_user_bg' ) ,
content => [ content => [
{ fg => themed( ( $> == 0 ) ? 'uh_root_fg' : 'uh_user_fg' ) } , { fg => themed( ( $> == 0 ) ? 'uh_root_fg' : 'uh_user_fg' ) } ,
$str @out
] , ] ,
}; };
} }
@ -820,8 +821,14 @@ sub render_prevcmd
my $col = themed( ( $status == 0 ) ? 'pcmd_ok_fg' : 'pcmd_err_fg' ); my $col = themed( ( $status == 0 ) ? 'pcmd_ok_fg' : 'pcmd_err_fg' );
my @out = (); my @out = ();
if ( $ss ) { if ( $ss ) {
push @out , { fg => ( ( $cl & 1 ) != 0 ) ? $col : -1 }; @out = ( @out ,
push @out , themed( $status == 0 ? 'pcmd_ok_sym' : 'pcmd_err_sym' ); {
fg => ( ( $cl & 1 ) != 0 ) ? $col : -1 ,
style => 'b'
} ,
themed( $status == 0 ? 'pcmd_ok_sym' : 'pcmd_err_sym' ) ,
{ style => 'none' } ,
);
} }
if ( $sc ) { if ( $sc ) {
push @out , ' ' if @out; push @out , ' ' if @out;
@ -874,10 +881,13 @@ sub render_load
$cat = 'high'; $cat = 'high';
} }
$load = (themed 'load_title') . $load . '%';
return { return {
bg => themed( 'load_' . $cat . '_bg' ) , bg => themed( 'load_' . $cat . '_bg' ) ,
content => [ {fg=>themed( 'load_' . $cat . '_fg' )}, $load ] content => [
{fg=>themed( 'load_' . $cat . '_fg' )},
(themed 'load_title') ,
{style=>'b'}, $load . '%' , {style=>'none'},
]
}; };
} }
@ -909,7 +919,10 @@ sub _render_git_branch
bg => themed( 'git_branch_' . $branch_warning . '_bg' ) , bg => themed( 'git_branch_' . $branch_warning . '_bg' ) ,
content => [ content => [
{fg => themed( 'git_branch_' . $branch_warning . '_fg' )} , {fg => themed( 'git_branch_' . $branch_warning . '_fg' )} ,
themed( 'git_branch_symbol' ) . $branch themed( 'git_branch_symbol' ) ,
{style=>'b'},
$branch,
{style=>'none'},
] ]
}; };
} }
@ -1002,7 +1015,9 @@ sub _render_git_status
content => [ content => [
{fg=>$fg[0]} , {fg=>$fg[0]} ,
themed( 'git_' . $sec_name . '_symbol' ) , themed( 'git_' . $sec_name . '_symbol' ) ,
@subsecs {style=>'b'},
@subsecs,
{style=>'none'},
] ]
}; };
} }
@ -1022,7 +1037,10 @@ sub _render_git_stash
bg => themed('git_stash_bg') , bg => themed('git_stash_bg') ,
content => [ content => [
{fg=>themed('git_stash_fg')} , {fg=>themed('git_stash_fg')} ,
themed('git_stash_symbol') . $nl themed('git_stash_symbol') ,
{style=>'b'},
$nl ,
{style=>'none'},
] ]
}; };
} }
@ -1054,8 +1072,8 @@ sub render_pyenv
return { return {
bg => themed 'pyenv_bg' , bg => themed 'pyenv_bg' ,
content => [ content => [
{fg=>themed 'pyenv_fg'} , {fg=>themed 'pyenv_fg'} , 'PY:' ,
'PY:' . $env {style=>'b'}, $env , {style=>'none'},
] , ] ,
}; };
} }