@@ -961,20 +961,37 @@ fn draw_git_graph(f: &mut Frame, area: Rect, app: &App) {
961961 lines. push ( Line :: from ( main_spans) ) ;
962962
963963 // render behind branch labels below main track at their positions
964+ // show arrow pointing up to the commit and (-N) indicator
964965 if !graph. labels_behind . is_empty ( ) {
965- let mut behind_str = String :: new ( ) ;
966+ // first line: arrows pointing up to the commits
967+ let mut arrow_str = String :: new ( ) ;
966968 for label in & graph. labels_behind {
967- // position label under its commit
968- // position is in oldest-first indexing (0 = leftmost)
969969 let offset = label. position * chars_per_commit;
970- while behind_str . len ( ) < offset {
971- behind_str . push ( ' ' ) ;
970+ while arrow_str . len ( ) < offset {
971+ arrow_str . push ( ' ' ) ;
972972 }
973- behind_str. push_str ( & label. name ) ;
974- behind_str. push ( ' ' ) ;
973+ arrow_str. push ( '↑' ) ;
975974 }
976975 lines. push ( Line :: from ( Span :: styled (
977- behind_str,
976+ arrow_str,
977+ Style :: default ( ) . fg ( Color :: Yellow ) ,
978+ ) ) ) ;
979+
980+ // second line: branch names with behind count
981+ let mut label_str = String :: new ( ) ;
982+ for label in & graph. labels_behind {
983+ let offset = label. position * chars_per_commit;
984+ // try to center the label under the arrow
985+ let label_text = format ! ( "{} (-{})" , label. name, label. behind) ;
986+ let label_start = offset. saturating_sub ( label_text. len ( ) / 2 ) ;
987+ while label_str. len ( ) < label_start {
988+ label_str. push ( ' ' ) ;
989+ }
990+ label_str. push_str ( & label_text) ;
991+ label_str. push ( ' ' ) ;
992+ }
993+ lines. push ( Line :: from ( Span :: styled (
994+ label_str,
978995 Style :: default ( ) . fg ( Color :: Yellow ) ,
979996 ) ) ) ;
980997 }
0 commit comments