@@ -666,6 +666,8 @@ where
666666 }
667667 ) ;
668668
669+ append_readme_lines ( & mut lines, readme, inner_width) ;
670+
669671 let Some ( def) = def else {
670672 if !pkg_dir_missing {
671673 lines. push ( Line :: from ( "" ) ) ;
@@ -774,25 +776,29 @@ where
774776 }
775777 }
776778
777- // README
778- if let Some ( readme) = readme {
779- lines. push ( Line :: from ( "" ) ) ;
780- lines. push ( Line :: from ( Span :: styled ( "README.md" . to_string ( ) , bold) ) ) ;
781- for raw in readme. lines ( ) {
782- let line = raw. replace ( '\r' , "" ) ;
783- for chunk in wrap_into_chunks ( & line, inner_width. saturating_sub ( 2 ) ) {
784- lines. push ( Line :: from ( vec ! [
785- Span :: styled( " " . to_string( ) , base_style( ) ) ,
786- Span :: styled( chunk, base_style( ) ) ,
787- ] ) ) ;
788- }
789- if line. is_empty ( ) {
790- lines. push ( Line :: from ( "" ) ) ;
791- }
779+ lines
780+ }
781+
782+ fn append_readme_lines < ' a > ( lines : & mut Vec < Line < ' a > > , readme : Option < & str > , inner_width : usize ) {
783+ let Some ( readme) = readme else {
784+ return ;
785+ } ;
786+ let bold = base_style ( ) . add_modifier ( ratatui:: style:: Modifier :: BOLD ) ;
787+ lines. push ( Line :: from ( "" ) ) ;
788+ lines. push ( Line :: from ( Span :: styled ( "README.md" . to_string ( ) , bold) ) ) ;
789+ for raw in readme. lines ( ) {
790+ let line = raw. replace ( '\r' , "" ) ;
791+ if line. is_empty ( ) {
792+ lines. push ( Line :: from ( "" ) ) ;
793+ continue ;
794+ }
795+ for chunk in wrap_into_chunks ( & line, inner_width. saturating_sub ( 2 ) ) {
796+ lines. push ( Line :: from ( vec ! [
797+ Span :: styled( " " . to_string( ) , base_style( ) ) ,
798+ Span :: styled( chunk, base_style( ) ) ,
799+ ] ) ) ;
792800 }
793801 }
794-
795- lines
796802}
797803
798804fn append_step_lines < ' a , F > (
0 commit comments