#NEWLINE# @ if_connected #NEWLINE# def on_modified( self , view , agent ) : #NEWLINE# #INDENT# buf = is_view_loaded ( view ) #NEWLINE# if ( not buf ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# text = get_text ( view ) #NEWLINE# if ( buf [ 'encoding' ] != 'utf8' ) : #NEWLINE# #INDENT# return msg . warn ( 'Floobits does not support patching binary files at this time' ) #NEWLINE# #UNINDENT# text = text . encode ( 'utf-8' ) #NEWLINE# view_md5 = hashlib . md5 ( text ) . hexdigest ( ) #NEWLINE# bid = view . buffer_id ( ) #NEWLINE# buf [ 'forced_patch' ] = False #NEWLINE# if ( view_md5 == G . VIEW_TO_HASH . get ( bid ) ) : #NEWLINE# #INDENT# self . _highlights . add ( bid ) #NEWLINE# return #NEWLINE# #UNINDENT# G . VIEW_TO_HASH [ view . buffer_id ( ) ] = view_md5 #NEWLINE# msg . debug ( 'changed view ' , buf [ 'path' ] , ' buf id ' , buf [ 'id' ] ) #NEWLINE# self . disable_follow_mode ( 2000 ) #NEWLINE# agent . views_changed . append ( ( 'patch' , view , buf ) )