#NEWLINE# def trim_to_sel( self , * args ) : #NEWLINE# #INDENT# 'Cut list items with indices in sorted_keys that are less than or\n        greater than the index of the last selected item if there is a\n        selection. This preserves intervening list items within the selected\n        range.\n        ' #NEWLINE# if ( len ( self . selection ) > 0 ) : #NEWLINE# #INDENT# sel_indices = [ sel . index for sel in sel . selection ] #NEWLINE# first_sel_index = min ( sel_indices ) #NEWLINE# last_sel_index = max ( sel_indices ) #NEWLINE# self . data = self . data [ first_sel_index : ( last_sel_index + 1 ) ]