@@ -117,6 +117,29 @@ struct Bucket {
117117 indices : Vec < InstanceIdx > ,
118118}
119119
120+ /// Keep only the rows the user picked, then rewrite each remaining row's
121+ /// `dependency_outdated_count` to the sum of bucket counts that survived
122+ /// the filter for its (group, dependency). Otherwise a multi-bucket dep
123+ /// with one bucket left would still print the original total.
124+ pub fn filter_rows_for_display ( rows : & [ UpdateRow ] , selection : & [ bool ] ) -> Vec < UpdateRow > {
125+ let mut filtered: Vec < UpdateRow > = rows
126+ . iter ( )
127+ . zip ( selection. iter ( ) )
128+ . filter ( |& ( _, & picked) | picked)
129+ . map ( |( row, _) | row. clone ( ) )
130+ . collect ( ) ;
131+ let mut totals: std:: collections:: HashMap < ( usize , String ) , usize > = std:: collections:: HashMap :: new ( ) ;
132+ for row in & filtered {
133+ * totals. entry ( ( row. group_idx , row. dependency_name . clone ( ) ) ) . or_insert ( 0 ) += row. bucket_count ;
134+ }
135+ for row in & mut filtered {
136+ if let Some ( total) = totals. get ( & ( row. group_idx , row. dependency_name . clone ( ) ) ) {
137+ row. dependency_outdated_count = * total;
138+ }
139+ }
140+ filtered
141+ }
142+
120143pub fn run < D : DiskIo > ( mut ctx : Context , registry_updates : RegistryUpdates , io : & D , tui : & dyn Tui ) -> Result < Context , SyncpackError > {
121144 let now = update_row:: unix_now ( ) ;
122145 let rows = build_update_rows ( & ctx, & registry_updates, now) ;
@@ -158,9 +181,12 @@ pub fn run<D: DiskIo>(mut ctx: Context, registry_updates: RegistryUpdates, io: &
158181 ( None , ( 0 ..rows. len ( ) ) . collect ( ) )
159182 } ;
160183
161- update_row:: render_rows ( & rows, selection. as_deref ( ) ) ;
184+ let filtered_for_display: Option < Vec < UpdateRow > > = selection. as_deref ( ) . map ( |sel| filter_rows_for_display ( & rows, sel) ) ;
185+ let display_rows: & [ UpdateRow ] = filtered_for_display. as_deref ( ) . unwrap_or ( & rows) ;
186+
187+ update_row:: render_rows ( display_rows, None ) ;
162188
163- let counts = update_row:: count_diffs ( & rows ) ;
189+ let counts = update_row:: count_diffs ( display_rows ) ;
164190 update_row:: render_summary ( counts) ;
165191
166192 // Apply selected rows by copying expected → actual through the
0 commit comments