#NEWLINE# def save( self , view , where = 'unknow' ) : #NEWLINE# #INDENT# if ( ( view is None ) or ( not view . file_name ( ) ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if view . is_loading ( ) : #NEWLINE# #INDENT# sublime . set_timeout ( ( lambda : self . save ( view , where ) ) , 100 ) #NEWLINE# return #NEWLINE# #UNINDENT# _id = self . view_index ( view ) #NEWLINE# if ( _id not in self . db ) : #NEWLINE# #INDENT# self . db [ _id ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# old_db = dict ( self . db [ _id ] ) #NEWLINE# self . db [ _id ] [ 'id' ] = int ( view . size ( ) ) #NEWLINE# self . db [ _id ] [ 'm' ] = [ [ item . a , item . b ] for item in view . get_regions ( 'mark' ) ] #NEWLINE# if self . debug : #NEWLINE# #INDENT# print ( ( 'marks: ' + str ( self . db [ _id ] [ 'm' ] ) ) ) #NEWLINE# #UNINDENT# if ( ( 'f' in self . db [ _id ] ) and ( list ( self . db [ _id ] [ 'f' ] ) != [ ] ) ) : #NEWLINE# #INDENT# self . db [ _id ] [ 'pf' ] = list ( self . db [ _id ] [ 'f' ] ) #NEWLINE# #UNINDENT# self . db [ _id ] [ 'f' ] = [ [ item . a , item . b ] for item in view . folded_regions ( ) ] #NEWLINE# if self . debug : #NEWLINE# #INDENT# print ( ( 'fold: ' + str ( self . db [ _id ] [ 'f' ] ) ) ) #NEWLINE# #UNINDENT# if ( ( old_db != self . db [ item ] ) or ( where == 'on_deactivated' ) ) : #NEWLINE# #INDENT# with GzipFile ( self . store , 'wb' ) as f : #NEWLINE# #INDENT# dump ( self . db , f , ( - 1 ) )