11use std:: { collections:: BTreeMap , mem:: take, ops:: Bound } ;
22
33use egui:: {
4- style:: ScrollAnimation , text:: LayoutJob , CollapsingHeader , Color32 , Id , OpenUrl , ScrollArea ,
5- SelectableLabel , TextEdit , Ui , Widget ,
4+ style:: ScrollAnimation , text:: LayoutJob , CollapsingHeader , Color32 , Id , Layout , OpenUrl ,
5+ ScrollArea , SelectableLabel , TextEdit , Ui , Widget ,
66} ;
77use objdiff_core:: {
88 arch:: ObjArch ,
@@ -605,6 +605,7 @@ pub enum SymbolFilter<'a> {
605605}
606606
607607#[ must_use]
608+ #[ expect( clippy:: too_many_arguments) ]
608609pub fn symbol_list_ui (
609610 ui : & mut Ui ,
610611 ctx : SymbolDiffContext < ' _ > ,
@@ -613,6 +614,7 @@ pub fn symbol_list_ui(
613614 filter : SymbolFilter < ' _ > ,
614615 appearance : & Appearance ,
615616 column : usize ,
617+ open_sections : Option < bool > ,
616618) -> Option < DiffViewAction > {
617619 let mut ret = None ;
618620 ScrollArea :: both ( ) . auto_shrink ( [ false , false ] ) . show ( ui, |ui| {
@@ -766,6 +768,7 @@ pub fn symbol_list_ui(
766768 CollapsingHeader :: new ( header)
767769 . id_salt ( Id :: new ( section. name . clone ( ) ) . with ( section. orig_index ) )
768770 . default_open ( true )
771+ . open ( open_sections)
769772 . show ( ui, |ui| {
770773 if section. kind == ObjSectionKind :: Code && state. reverse_fn_order {
771774 for ( symbol, symbol_diff) in mapping
@@ -873,6 +876,7 @@ pub fn symbol_diff_ui(
873876
874877 // Header
875878 let available_width = ui. available_width ( ) ;
879+ let mut open_sections = ( None , None ) ;
876880 render_header ( ui, available_width, 2 , |ui, column| {
877881 if column == 0 {
878882 // Left column
@@ -891,14 +895,25 @@ pub fn symbol_diff_ui(
891895 }
892896 } ) ;
893897
894- let mut search = state. search . clone ( ) ;
895- let response = TextEdit :: singleline ( & mut search) . hint_text ( "Filter symbols" ) . ui ( ui) ;
896- if hotkeys:: consume_symbol_filter_shortcut ( ui. ctx ( ) ) {
897- response. request_focus ( ) ;
898- }
899- if response. changed ( ) {
900- ret = Some ( DiffViewAction :: SetSearch ( search) ) ;
901- }
898+ ui. horizontal ( |ui| {
899+ let mut search = state. search . clone ( ) ;
900+ let response = TextEdit :: singleline ( & mut search) . hint_text ( "Filter symbols" ) . ui ( ui) ;
901+ if hotkeys:: consume_symbol_filter_shortcut ( ui. ctx ( ) ) {
902+ response. request_focus ( ) ;
903+ }
904+ if response. changed ( ) {
905+ ret = Some ( DiffViewAction :: SetSearch ( search) ) ;
906+ }
907+
908+ ui. with_layout ( Layout :: right_to_left ( egui:: Align :: TOP ) , |ui| {
909+ if ui. small_button ( "⏷" ) . on_hover_text_at_pointer ( "Expand all" ) . clicked ( ) {
910+ open_sections. 0 = Some ( true ) ;
911+ }
912+ if ui. small_button ( "⏶" ) . on_hover_text_at_pointer ( "Collapse all" ) . clicked ( ) {
913+ open_sections. 0 = Some ( false ) ;
914+ }
915+ } )
916+ } ) ;
902917 } else if column == 1 {
903918 // Right column
904919 ui. horizontal ( |ui| {
@@ -930,9 +945,20 @@ pub fn symbol_diff_ui(
930945 }
931946 } ) ;
932947
933- if ui. add_enabled ( !state. build_running , egui:: Button :: new ( "Build" ) ) . clicked ( ) {
934- ret = Some ( DiffViewAction :: Build ) ;
935- }
948+ ui. horizontal ( |ui| {
949+ if ui. add_enabled ( !state. build_running , egui:: Button :: new ( "Build" ) ) . clicked ( ) {
950+ ret = Some ( DiffViewAction :: Build ) ;
951+ }
952+
953+ ui. with_layout ( Layout :: right_to_left ( egui:: Align :: TOP ) , |ui| {
954+ if ui. small_button ( "⏷" ) . on_hover_text_at_pointer ( "Expand all" ) . clicked ( ) {
955+ open_sections. 1 = Some ( true ) ;
956+ }
957+ if ui. small_button ( "⏶" ) . on_hover_text_at_pointer ( "Collapse all" ) . clicked ( ) {
958+ open_sections. 1 = Some ( false ) ;
959+ }
960+ } )
961+ } ) ;
936962 }
937963 } ) ;
938964
@@ -957,6 +983,7 @@ pub fn symbol_diff_ui(
957983 filter,
958984 appearance,
959985 column,
986+ open_sections. 0 ,
960987 ) {
961988 ret = Some ( result) ;
962989 }
@@ -981,6 +1008,7 @@ pub fn symbol_diff_ui(
9811008 filter,
9821009 appearance,
9831010 column,
1011+ open_sections. 1 ,
9841012 ) {
9851013 ret = Some ( result) ;
9861014 }
0 commit comments