From 168665b7e47728933f75af955811cef2345df1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 23 Oct 2020 13:12:05 +0200 Subject: [PATCH 1/3] Use bold styles in a few sections --- gprompt.pl | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/gprompt.pl b/gprompt.pl index cff771f..cbf9920 100644 --- a/gprompt.pl +++ b/gprompt.pl @@ -783,24 +783,25 @@ sub render_userhost } } - my $str = ''; + my @out = (); if ( $un ) { - $str .= getpwuid( $< ) || '(?)'; + push @out , ( getpwuid( $< ) || '(?)' ); } if ( $hn == 1 || ( $hn == 2 && $is_remote ) ) { - $str .= '@' if $str; - $str .= hostname; + push @out , '@' if @out; + push @out , hostname; } 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 { bg => themed( ( $> == 0 ) ? 'uh_root_bg' : 'uh_user_bg' ) , content => [ { 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 @out = (); if ( $ss ) { - push @out , { fg => ( ( $cl & 1 ) != 0 ) ? $col : -1 }; - push @out , themed( $status == 0 ? 'pcmd_ok_sym' : 'pcmd_err_sym' ); + @out = ( @out , + { + fg => ( ( $cl & 1 ) != 0 ) ? $col : -1 , + style => 'b' + } , + themed( $status == 0 ? 'pcmd_ok_sym' : 'pcmd_err_sym' ) , + { style => 'none' } , + ); } if ( $sc ) { push @out , ' ' if @out; @@ -909,7 +916,10 @@ sub _render_git_branch bg => themed( 'git_branch_' . $branch_warning . '_bg' ) , content => [ {fg => themed( 'git_branch_' . $branch_warning . '_fg' )} , - themed( 'git_branch_symbol' ) . $branch + themed( 'git_branch_symbol' ) , + {style=>'b'}, + $branch, + {style=>'none'}, ] }; } @@ -1002,7 +1012,9 @@ sub _render_git_status content => [ {fg=>$fg[0]} , themed( 'git_' . $sec_name . '_symbol' ) , - @subsecs + {style=>'b'}, + @subsecs, + {style=>'none'}, ] }; } @@ -1022,7 +1034,10 @@ sub _render_git_stash bg => themed('git_stash_bg') , content => [ {fg=>themed('git_stash_fg')} , - themed('git_stash_symbol') . $nl + themed('git_stash_symbol') , + {style=>'b'}, + $nl , + {style=>'none'}, ] }; } @@ -1054,8 +1069,8 @@ sub render_pyenv return { bg => themed 'pyenv_bg' , content => [ - {fg=>themed 'pyenv_fg'} , - 'PY:' . $env + {fg=>themed 'pyenv_fg'} , 'PY:' , + {style=>'b'}, $env , {style=>'none'}, ] , }; } From d97292719f1fc3ff670c4bbecad319bcfbadcabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 23 Oct 2020 13:16:40 +0200 Subject: [PATCH 2/3] More bold (load average display) --- gprompt.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gprompt.pl b/gprompt.pl index cbf9920..a913be6 100644 --- a/gprompt.pl +++ b/gprompt.pl @@ -881,10 +881,13 @@ sub render_load $cat = 'high'; } - $load = (themed 'load_title') . $load . '%'; return { 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'}, + ] }; } From 4b84f067e765fb7d1f3d831a8fb7dd1cc887116f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 23 Oct 2020 13:20:07 +0200 Subject: [PATCH 3/3] Reset style before generating transitions --- gprompt.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gprompt.pl b/gprompt.pl index a913be6..bc344e1 100644 --- a/gprompt.pl +++ b/gprompt.pl @@ -363,7 +363,7 @@ sub gen_transition my @colors = ( @_ , @{ themed 'transition' } ); my $state = 0; my $pc; - my $out = [ ]; + my $out = [ {style=>'none'} ]; foreach my $char ( split // , $transition ) { if ( $state == 1 ) { if ( $char eq 'f' || $char eq 'b' ) {