#NEWLINE# def run( self , edit , * args , **kwargs ) : #NEWLINE# #INDENT# command = 'search' #NEWLINE# size = len ( command ) #NEWLINE# min_length = global_settings ( 'preview_min_length' , 0 ) #NEWLINE# if ( self . view . size ( ) > ( 6 + min_length ) ) : #NEWLINE# #INDENT# start = perf_counter ( ) #NEWLINE# pattern = self . view . substr ( sublime . Region ( 0 , self . view . size ( ) ) ) #NEWLINE# active_view = sublime . active_window ( ) . active_view ( ) #NEWLINE# SelectionPreview . save_selection ( active_view ) #NEWLINE# separator_pattern = '\\s*\\|\\s*' #NEWLINE# command_list = 'find|search|add|remove|reduce|subtract|filter|live' #NEWLINE# sre = '(?P<sep>{sep})?\\b(?P<command>{command}) (?P<content>.*?)\\s*?(?=(?:{sep})|(?:{command})|$)' . format ( sep = separator_pattern , command = command_list ) #NEWLINE# command_pattern = re . compile ( sre , re . IGNORECASE ) #NEWLINE# selection = Selection ( ) #NEWLINE# for match in command_pattern . finditer ( self . view . substr ( sublime . Region ( 0 , self . view . size ( ) ) ) ) : #NEWLINE# #INDENT# command = TextPastryPreviewSelectionCommand ( active_view ) #NEWLINE# command . selection = selection #NEWLINE# command . run ( None , match . group ( 'content' ) , ** self . command_options ( match . group ( 'command' ) ) ) #NEWLINE# command . selection = None #NEWLINE# #UNINDENT# selection_preview = SelectionPreview ( ) #NEWLINE# selection_preview . draw ( active_view , selection ) #NEWLINE# selection = None #NEWLINE# sublime . status_message ( ( ( 'done: ' + str ( ( perf_counter ( ) - start ) ) ) + 's' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'clearing' , self . view . size ( ) ) #NEWLINE# SelectionPreview . clear ( )