@@ -96,18 +96,26 @@ def perform_search(self, text):
9696 def on_highlighted (self , file_no ):
9797 self .last_selected_result_index = file_no
9898 if file_no != - 1 and file_no != len (self .results ) - 1 : # last result is "list in view"
99- file_name_and_col = self .common_path .replace ('\" ' , '' ) + self .results [file_no ][0 ]
100- view = self .window .open_file (file_name_and_col , sublime .ENCODED_POSITION | sublime .TRANSIENT )
99+ self .open_and_highlight_file (file_no , transient = True )
100+
101+ def open_and_highlight_file (self , file_no , transient = False ):
102+ file_name_and_col = self .common_path .replace ('\" ' , '' ) + self .results [file_no ][0 ]
103+ flags = sublime .ENCODED_POSITION
104+ if transient :
105+ flags |= sublime .TRANSIENT
106+ view = self .window .open_file (file_name_and_col , flags )
107+
108+ regions = view .find_all (self .last_search_string , sublime .IGNORECASE )
109+ view .add_regions ("search_in_project" , regions , "entity.name.filename.find-in-files" , "circle" , sublime .DRAW_OUTLINED )
101110
102111 def goto_result (self , file_no ):
103- if file_no != - 1 :
112+ if file_no == - 1 :
113+ self .clear_markup ()
114+ else :
104115 if file_no == len (self .results ) - 1 : # last result is "list in view"
105116 self .list_in_view ()
106117 else :
107- file_name_and_col = self .common_path .replace ('\" ' , '' ) + self .results [file_no ][0 ]
108- view = self .window .open_file (file_name_and_col , sublime .ENCODED_POSITION )
109- regions = view .find_all (self .last_search_string , sublime .IGNORECASE )
110- view .add_regions ("search_in_project" , regions , "entity.name.filename.find-in-files" , "circle" , sublime .DRAW_OUTLINED )
118+ self .open_and_highlight_file (file_no )
111119
112120 def goto_relative_result (self , offset ):
113121 if self .last_search_string :
0 commit comments