1
1
use std:: { collections:: BTreeMap , mem:: take, ops:: Bound } ;
2
2
3
3
use 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 ,
6
6
} ;
7
7
use objdiff_core:: {
8
8
arch:: ObjArch ,
@@ -605,6 +605,7 @@ pub enum SymbolFilter<'a> {
605
605
}
606
606
607
607
#[ must_use]
608
+ #[ expect( clippy:: too_many_arguments) ]
608
609
pub fn symbol_list_ui (
609
610
ui : & mut Ui ,
610
611
ctx : SymbolDiffContext < ' _ > ,
@@ -613,6 +614,7 @@ pub fn symbol_list_ui(
613
614
filter : SymbolFilter < ' _ > ,
614
615
appearance : & Appearance ,
615
616
column : usize ,
617
+ open_sections : Option < bool > ,
616
618
) -> Option < DiffViewAction > {
617
619
let mut ret = None ;
618
620
ScrollArea :: both ( ) . auto_shrink ( [ false , false ] ) . show ( ui, |ui| {
@@ -766,6 +768,7 @@ pub fn symbol_list_ui(
766
768
CollapsingHeader :: new ( header)
767
769
. id_salt ( Id :: new ( section. name . clone ( ) ) . with ( section. orig_index ) )
768
770
. default_open ( true )
771
+ . open ( open_sections)
769
772
. show ( ui, |ui| {
770
773
if section. kind == ObjSectionKind :: Code && state. reverse_fn_order {
771
774
for ( symbol, symbol_diff) in mapping
@@ -873,6 +876,7 @@ pub fn symbol_diff_ui(
873
876
874
877
// Header
875
878
let available_width = ui. available_width ( ) ;
879
+ let mut open_sections = ( None , None ) ;
876
880
render_header ( ui, available_width, 2 , |ui, column| {
877
881
if column == 0 {
878
882
// Left column
@@ -891,14 +895,25 @@ pub fn symbol_diff_ui(
891
895
}
892
896
} ) ;
893
897
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
+ } ) ;
902
917
} else if column == 1 {
903
918
// Right column
904
919
ui. horizontal ( |ui| {
@@ -930,9 +945,20 @@ pub fn symbol_diff_ui(
930
945
}
931
946
} ) ;
932
947
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
+ } ) ;
936
962
}
937
963
} ) ;
938
964
@@ -957,6 +983,7 @@ pub fn symbol_diff_ui(
957
983
filter,
958
984
appearance,
959
985
column,
986
+ open_sections. 0 ,
960
987
) {
961
988
ret = Some ( result) ;
962
989
}
@@ -981,6 +1008,7 @@ pub fn symbol_diff_ui(
981
1008
filter,
982
1009
appearance,
983
1010
column,
1011
+ open_sections. 1 ,
984
1012
) {
985
1013
ret = Some ( result) ;
986
1014
}
0 commit comments