File tree Expand file tree Collapse file tree
crates/terraphim_agent/src/repl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2777,7 +2777,13 @@ impl ReplHandler {
27772777 for cluster in & clusters {
27782778 let concepts = cluster. dominant_concepts . join ( ", " ) ;
27792779 let concepts_display = if concepts. len ( ) > 40 {
2780- format ! ( "{}..." , & concepts[ ..40 ] )
2780+ let end = concepts
2781+ . char_indices ( )
2782+ . take ( 40 )
2783+ . last ( )
2784+ . map ( |( i, _) | i)
2785+ . unwrap_or ( concepts. len ( ) ) ;
2786+ format ! ( "{}..." , & concepts[ ..end] )
27812787 } else {
27822788 concepts
27832789 } ;
@@ -2787,7 +2793,13 @@ impl ReplHandler {
27872793 . and_then ( |s| s. title . as_ref ( ) )
27882794 . map ( |t| {
27892795 if t. len ( ) > 35 {
2790- format ! ( "{}..." , & t[ ..35 ] )
2796+ let end = t
2797+ . char_indices ( )
2798+ . take ( 35 )
2799+ . last ( )
2800+ . map ( |( i, _) | i)
2801+ . unwrap_or ( t. len ( ) ) ;
2802+ format ! ( "{}..." , & t[ ..end] )
27912803 } else {
27922804 t. clone ( )
27932805 }
You can’t perform that action at this time.
0 commit comments