@@ -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 scroll_to_diff_row : Option < usize > ,
122124 pub build_running : bool ,
123125 pub scratch_available : bool ,
@@ -155,6 +157,9 @@ impl DiffViewState {
155157 self . current_view = result. view ;
156158 self . symbol_state . left_symbol = result. left_symbol ;
157159 self . symbol_state . right_symbol = result. right_symbol ;
160+ // Clear the mapping filter so it's not saved between mapping different symbols.
161+ self . mapping_search = "" . to_string ( ) ;
162+ self . mapping_search_regex = None ;
158163 }
159164
160165 false
@@ -269,12 +274,7 @@ impl DiffViewState {
269274 self . symbol_state . autoscroll_to_highlighted_symbols = autoscroll;
270275 }
271276 DiffViewAction :: SetSearch ( search) => {
272- self . search_regex = if search. is_empty ( ) {
273- None
274- } else {
275- RegexBuilder :: new ( & search) . case_insensitive ( true ) . build ( ) . ok ( )
276- } ;
277- self . search = search;
277+ self . set_current_search ( search) ;
278278 }
279279 DiffViewAction :: CreateScratch ( function_name) => {
280280 let Ok ( state) = state. read ( ) else {
@@ -395,6 +395,29 @@ impl DiffViewState {
395395 target_symbol : symbol_diff. target_symbol ,
396396 } )
397397 }
398+
399+ pub fn get_current_search ( & self ) -> String {
400+ if self . current_view == View :: FunctionDiff {
401+ self . mapping_search . clone ( )
402+ } else {
403+ self . search . clone ( )
404+ }
405+ }
406+
407+ fn set_current_search ( & mut self , search : String ) {
408+ let search_regex = if search. is_empty ( ) {
409+ None
410+ } else {
411+ RegexBuilder :: new ( & search) . case_insensitive ( true ) . build ( ) . ok ( )
412+ } ;
413+ if self . current_view == View :: FunctionDiff {
414+ self . mapping_search = search;
415+ self . mapping_search_regex = search_regex;
416+ } else {
417+ self . search = search;
418+ self . search_regex = search_regex;
419+ }
420+ }
398421}
399422
400423struct ResolvedSymbol < ' obj > {
0 commit comments