#NEWLINE# def find_in_region( self , pattern , flags , region ) : #NEWLINE# #INDENT# ( text , offset ) = ( self . view . substr ( region ) , region . begin ( ) ) #NEWLINE# timeout = global_settings ( 'preview_find_timeout' , 2 ) #NEWLINE# ( R , tpc ) = ( sublime . Region , perf_counter ) #NEWLINE# re_flags = 0 #NEWLINE# if ( offset & sublime . IGNORECASE ) : #NEWLINE# #INDENT# re_flags = re . IGNORECASE #NEWLINE# #UNINDENT# if ( flags & sublime . LITERAL ) : #NEWLINE# #INDENT# pattern = re . escape ( pattern ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# regex = re . compile ( pattern , re_flags ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# regex = re . compile ( re . escape ( pattern ) , re_flags ) #NEWLINE# #UNINDENT# matches = regex . finditer ( text ) #NEWLINE# start_time = tpc ( ) #NEWLINE# return [ sublime . Region ( ( m . start ( ) + offset ) , ( m . end ( ) + offset ) ) for m in matches if ( ( ( tpc ( ) - start_time ) < timeout ) and ( not self . cancel ) ) ]