#NEWLINE# def run( self , edit , start = 0 , stop = None , step = 1 , padding = 1 , fillchar = '0' , justify = None , align = None , prefix = None , suffix = None , repeat_increment = None ) : #NEWLINE# #INDENT# print ( 'found range command' , start , stop , step ) #NEWLINE# print ( 'repeat increment:' , repeat_increment ) #NEWLINE# start = ( int ( start ) if start else 0 ) #NEWLINE# step = ( int ( step ) if step else 1 ) #NEWLINE# stop = ( int ( stop ) if stop else None ) #NEWLINE# padding = ( int ( padding ) if padding else 0 ) #NEWLINE# if ( stop is not None ) : #NEWLINE# #INDENT# repeat = abs ( ( start - stop ) ) #NEWLINE# sel = self . view . sel ( ) #NEWLINE# if ( len ( sel ) == 1 ) : #NEWLINE# #INDENT# TextPastryTools . duplicate ( self . view , edit , sel [ 0 ] , repeat ) #NEWLINE# #UNINDENT# #UNINDENT# if ( stop is None ) : #NEWLINE# #INDENT# stop = ( start + ( ( len ( self . view . sel ( ) ) + 1 ) * step ) ) #NEWLINE# #UNINDENT# if global_settings ( 'range_include_end_index' , True ) : #NEWLINE# #INDENT# stop += step #NEWLINE# #UNINDENT# if ( ( start > stop ) and ( step > 0 ) ) : #NEWLINE# #INDENT# step = ( step * ( - 1 ) ) #NEWLINE# #UNINDENT# items = [ str ( x ) for x in range ( start , stop , step ) ] #NEWLINE# if ( repeat_increment and ( repeat_increment > 0 ) ) : #NEWLINE# #INDENT# tmp = items #NEWLINE# items = [ ] #NEWLINE# for val in tmp : #NEWLINE# #INDENT# for x in range ( repeat_increment ) : #NEWLINE# #INDENT# items . append ( val ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( padding > 1 ) : #NEWLINE# #INDENT# fillchar = ( fillchar if ( fillchar is not None ) else '0' ) #NEWLINE# just = ( str . ljust if ( justify == 'left' ) else str . rjust ) #NEWLINE# items = [ self . pad ( x , just , padding , fillchar ) for x in items ] #NEWLINE# #UNINDENT# if prefix : #NEWLINE# #INDENT# items = [ ( prefix + x ) for x in items ] #NEWLINE# #UNINDENT# if suffix : #NEWLINE# #INDENT# items = [ ( x + suffix ) for x in items ] #NEWLINE# #UNINDENT# self . view . run_command ( 'text_pastry_insert_text' , { #NEWLINE# #INDENT# 'items' : items , #NEWLINE# 'align' : align , #NEWLINE# #UNINDENT# } )