From 319b1c35c0125edd9f71513001023e370c3f1cef Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 21 Jan 2023 13:01:21 -0500 Subject: [PATCH] Move reverse_fn_order into ViewConfig --- src/app.rs | 4 ++-- src/views/config.rs | 2 +- src/views/symbol_diff.rs | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app.rs b/src/app.rs index bf8c071..a1de3ca 100644 --- a/src/app.rs +++ b/src/app.rs @@ -67,6 +67,7 @@ pub struct ViewConfig { pub ui_font: FontId, pub code_font: FontId, pub diff_colors: Vec, + pub reverse_fn_order: bool, } impl Default for ViewConfig { @@ -75,6 +76,7 @@ impl Default for ViewConfig { ui_font: FontId { size: 12.0, family: FontFamily::Proportional }, code_font: FontId { size: 14.0, family: FontFamily::Monospace }, diff_colors: DEFAULT_COLOR_ROTATION.to_vec(), + reverse_fn_order: false, } } } @@ -113,7 +115,6 @@ pub struct ViewState { pub check_update: Option>, // Config pub diff_kind: DiffKind, - pub reverse_fn_order: bool, pub view_config: ViewConfig, } @@ -133,7 +134,6 @@ impl Default for ViewState { utc_offset: UtcOffset::UTC, check_update: None, diff_kind: Default::default(), - reverse_fn_order: false, view_config: Default::default(), } } diff --git a/src/views/config.rs b/src/views/config.rs index 9c8e7bf..c6e2ee8 100644 --- a/src/views/config.rs +++ b/src/views/config.rs @@ -247,6 +247,6 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc>, view_state: } } - ui.checkbox(&mut view_state.reverse_fn_order, "Reverse function order (deferred)"); + ui.checkbox(&mut view_state.view_config.reverse_fn_order, "Reverse function order (deferred)"); ui.separator(); } diff --git a/src/views/symbol_diff.rs b/src/views/symbol_diff.rs index 232d310..0fd5574 100644 --- a/src/views/symbol_diff.rs +++ b/src/views/symbol_diff.rs @@ -135,7 +135,6 @@ fn symbol_list_ui( highlighted_symbol: &mut Option, selected_symbol: &mut Option, current_view: &mut View, - reverse_function_order: bool, lower_search: &str, config: &ViewConfig, ) { @@ -164,7 +163,7 @@ fn symbol_list_ui( CollapsingHeader::new(format!("{} ({:x})", section.name, section.size)) .default_open(true) .show(ui, |ui| { - if section.kind == ObjSectionKind::Code && reverse_function_order { + if section.kind == ObjSectionKind::Code && config.reverse_fn_order { for symbol in section.symbols.iter().rev() { if !symbol_matches_search(symbol, lower_search) { continue; @@ -292,7 +291,6 @@ pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) { highlighted_symbol, selected_symbol, current_view, - view_state.reverse_fn_order, &lower_search, &view_state.view_config, ); @@ -312,7 +310,6 @@ pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) { highlighted_symbol, selected_symbol, current_view, - view_state.reverse_fn_order, &lower_search, &view_state.view_config, );