(self, edit, line, indented_region)
set count and index, track marks/selections, replace icon, erase indented_region
set count and index, track marks/selections, replace icon, erase indented_region
set count and index track marks / selections replace icon erase indented_region
def apply_change_into_view(self, edit, line, indented_region):
        '''set count and index, track marks/selections, replace icon, erase indented_region'''
        v = self.view

        # do not set count & index on empty directory
        if not line.contains(indented_region):
            removed_count = len(v.lines(indented_region))
            dired_count = v.settings().get('dired_count', 0)
            v.settings().set('dired_count', int(dired_count) - removed_count)
            if indented_region.b == v.size():
                # MUST avoid new line at eof
                indented_region = Region(indented_region.a - 1, indented_region.b)

            start_line = 1 + v.rowcol(line.a)[0]
            end_line   = start_line + removed_count
            self.index = self.index[:start_line] + self.index[end_line:]
            v.settings().set('dired_index', self.index)

        if self.marked or self.seled:
            path = self.path
            folded_name = self.get_parent(line, path)
            if self.marked:
                self.marked.append(folded_name)
            elif self.seled:
                self.seled[0].append(folded_name)

        name_point  = self._get_name_point(line)
        icon_region = Region(name_point - 2, name_point - 1)

        v.set_read_only(False)
        v.replace(edit, icon_region, u'▸')
        v.erase(edit, indented_region)
        v.set_read_only(True)
        emit_event(u'fold', (self.view.id(), self.index[start_line - 1]), view=self.view)
def apply_change_into_view ( self , edit , line , indented_region ) : v = self . view # do not set count & index on empty directory if not line . contains ( indented_region ) : removed_count = len ( v . lines ( indented_region ) ) dired_count = v . settings ( ) . get ( 'dired_count' , 0 ) v . settings ( ) . set ( 'dired_count' , int ( dired_count ) - removed_count ) if indented_region . b == v . size ( ) : # MUST avoid new line at eof indented_region = Region ( indented_region . a - 1 , indented_region . b ) start_line = 1 + v . rowcol ( line . a ) [ 0 ] end_line = start_line + removed_count self . index = self . index [ : start_line ] + self . index [ end_line : ] v . settings ( ) . set ( 'dired_index' , self . index ) if self . marked or self . seled : path = self . path folded_name = self . get_parent ( line , path ) if self . marked : self . marked . append ( folded_name ) elif self . seled : self . seled [ 0 ] . append ( folded_name ) name_point = self . _get_name_point ( line ) icon_region = Region ( name_point - 2 , name_point - 1 ) v . set_read_only ( False ) v . replace ( edit , icon_region , u'▸') v . erase ( edit , indented_region ) v . set_read_only ( True ) emit_event ( u'fold' , ( self . view . id ( ) , self . index [ start_line - 1 ] ) , view = self . view )