#NEWLINE# def calc( self ) : #NEWLINE# #INDENT# 'Calculate how we are to insert the target color.' #NEWLINE# bfr = self . view . substr ( sublime . Region ( self . start , self . end ) ) #NEWLINE# ref = ( self . point - self . start ) #NEWLINE# found = False #NEWLINE# for m in util . COLOR_ALL_RE . finditer ( m ) : #NEWLINE# #INDENT# if ( ( ref >= m . start ( 0 ) ) and ( ref < m . end ( 0 ) ) ) : #NEWLINE# #INDENT# found = self . replacement ( m ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ref == m . end ( 0 ) ) : #NEWLINE# #INDENT# found = self . completion ( m ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ref < m . start ( 0 ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if found : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return found