@@ -118,6 +118,8 @@ pub struct DiffViewState {
118118 pub function_state : FunctionViewState ,
119119 pub search : String ,
120120 pub search_regex : Option < Regex > ,
121+ pub mapping_search : String ,
122+ pub mapping_search_regex : Option < Regex > ,
121123 pub build_running : bool ,
122124 pub scratch_available : bool ,
123125 pub scratch_running : bool ,
@@ -154,6 +156,9 @@ impl DiffViewState {
154156 self . current_view = result. view ;
155157 self . symbol_state . left_symbol = result. left_symbol ;
156158 self . symbol_state . right_symbol = result. right_symbol ;
159+ // Clear the mapping filter so it's not saved between mapping different symbols.
160+ self . mapping_search = "" . to_string ( ) ;
161+ self . mapping_search_regex = None ;
157162 }
158163
159164 false
@@ -268,12 +273,7 @@ impl DiffViewState {
268273 self . symbol_state . autoscroll_to_highlighted_symbols = autoscroll;
269274 }
270275 DiffViewAction :: SetSearch ( search) => {
271- self . search_regex = if search. is_empty ( ) {
272- None
273- } else {
274- RegexBuilder :: new ( & search) . case_insensitive ( true ) . build ( ) . ok ( )
275- } ;
276- self . search = search;
276+ self . set_search ( search) ;
277277 }
278278 DiffViewAction :: CreateScratch ( function_name) => {
279279 let Ok ( state) = state. read ( ) else {
@@ -394,6 +394,29 @@ impl DiffViewState {
394394 target_symbol : symbol_diff. target_symbol ,
395395 } )
396396 }
397+
398+ pub fn get_current_search ( & self ) -> String {
399+ if self . current_view == View :: FunctionDiff {
400+ self . mapping_search . clone ( )
401+ } else {
402+ self . search . clone ( )
403+ }
404+ }
405+
406+ fn set_search ( & mut self , search : String ) {
407+ let search_regex = if search. is_empty ( ) {
408+ None
409+ } else {
410+ RegexBuilder :: new ( & search) . case_insensitive ( true ) . build ( ) . ok ( )
411+ } ;
412+ if self . current_view == View :: FunctionDiff {
413+ self . mapping_search = search;
414+ self . mapping_search_regex = search_regex;
415+ } else {
416+ self . search = search;
417+ self . search_regex = search_regex;
418+ }
419+ }
397420}
398421
399422struct ResolvedSymbol < ' obj > {
0 commit comments