Skip to content

Commit

Permalink
Allow filtering modules in the module browsing view
Browse files Browse the repository at this point in the history
  • Loading branch information
ergrelet committed Mar 7, 2024
1 parent f306c20 commit 3fe7525
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions resym/src/resym_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct ResymApp {
explorer_selected_tab: ExplorerTab,
type_search: TextSearchComponent,
type_list: TypeListComponent,
module_search: TextSearchComponent,
module_tree: ModuleTreeComponent,
code_view: CodeViewComponent,
console: ConsoleComponent,
Expand Down Expand Up @@ -143,6 +144,7 @@ impl ResymApp {
explorer_selected_tab: ExplorerTab::TypeSearch,
type_search: TextSearchComponent::new(),
type_list: TypeListComponent::new(),
module_search: TextSearchComponent::new(),
module_tree: ModuleTreeComponent::new(),
code_view: CodeViewComponent::new(),
console: ConsoleComponent::new(logger),
Expand Down Expand Up @@ -196,6 +198,7 @@ impl ResymApp {

match self.explorer_selected_tab {
ExplorerTab::TypeSearch => {
// Callback run when the search query changes
let on_query_update = |search_query: &str| {
// Update filtered list if filter has changed
let result = if let ResymAppMode::Comparing(..) = self.current_mode {
Expand Down Expand Up @@ -235,6 +238,27 @@ impl ResymApp {
);
}
ExplorerTab::ModuleBrowsing => {
// Callback run when the search query changes
let on_query_update = |search_query: &str| match self.current_mode {
ResymAppMode::Browsing(..) | ResymAppMode::Comparing(..) => {
// Request a module list update
if let Err(err) =
self.backend.send_command(BackendCommand::ListModules(
ResymPDBSlots::Main as usize,
search_query.to_string(),
self.settings.app_settings.search_case_insensitive,
self.settings.app_settings.search_use_regex,
))
{
log::error!("Failed to update module list: {}", err);
}
}
_ => {}
};
// Update the type search bar
self.module_search.update(ui, &on_query_update);
ui.add_space(4.0);

// Callback run when a module is selected in the tree
let on_module_selected =
|module_path: &ModulePath, module_info: &ModuleInfo| match self
Expand Down

0 comments on commit 3fe7525

Please sign in to comment.