(self, edit, filename, toggle)
Expand one directory is save and fast, thus we do it here,
        but for many directories calling refresh command
Expand one directory is save and fast, thus we do it here,
        but for many directories calling refresh command
Expand one directory is save and fast thus we do it here but for many directories calling refresh command
def expand_single_directory(self, edit, filename, toggle):
        '''Expand one directory is save and fast, thus we do it here,
        but for many directories calling refresh command'''
        marked = self.get_marked()
        seled  = self.get_selected()

        if toggle and self.try_to_fold(marked):
            return

        self.view.run_command('dired_fold', {'update': True, 'index': self.index})
        self.index = self.get_all()  # fold changed index, get a new one

        self.show_hidden = self.view.settings().get('dired_show_hidden_files', True)
        self.sel = self.view.get_regions('marked')[0] if marked else list(self.view.sel())[0]
        line     = self.view.line(self.sel)

        # number of next line to make slicing work properly
        self.number_line = 1 + self.view.rowcol(line.a)[0]
        # line may have inline error msg after os.sep
        root = self.view.substr(line).split(os.sep)[0].replace(u'▸', u'▾', 1) + os.sep

        items, error = self.try_listing_directory(filename)
        if error:
            replacement = [u'%s\t<%s>' % (root, error)]
        elif items:
            replacement = [root] + self.prepare_filelist(items, '', filename, '\t')
            dired_count = self.view.settings().get('dired_count', 0)
            self.view.settings().set('dired_count', dired_count + len(items))
        else:  # expanding empty folder, so notify that it is empty
            replacement = [u'%s\t<empty>' % root]

        self.view.set_read_only(False)
        self.view.replace(edit, line, '\n'.join(replacement))
        self.view.set_read_only(True)

        self.view.settings().set('dired_index', self.index)
        self.restore_marks(marked)
        self.restore_sels((seled, [self.sel]))
        self.view.run_command('dired_call_vcs', {'path': self.path})
        emit_event(u'finish_refresh', (self.view.id(), [filename]), view=self.view)
def expand_single_directory ( self , edit , filename , toggle ) : marked = self . get_marked ( ) seled = self . get_selected ( ) if toggle and self . try_to_fold ( marked ) : return self . view . run_command ( 'dired_fold' , { 'update' : True , 'index' : self . index } ) self . index = self . get_all ( ) # fold changed index, get a new one self . show_hidden = self . view . settings ( ) . get ( 'dired_show_hidden_files' , True ) self . sel = self . view . get_regions ( 'marked' ) [ 0 ] if marked else list ( self . view . sel ( ) ) [ 0 ] line = self . view . line ( self . sel ) # number of next line to make slicing work properly self . number_line = 1 + self . view . rowcol ( line . a ) [ 0 ] # line may have inline error msg after os.sep root = self . view . substr ( line ) . split ( os . sep ) [ 0 ] . replace ( u'▸',  u ▾', 1) o . ep items , error = self . try_listing_directory ( filename ) if error : replacement = [ u'%s\t<%s>' % ( root , error ) ] elif items : replacement = [ root ] + self . prepare_filelist ( items , '' , filename , '\t' ) dired_count = self . view . settings ( ) . get ( 'dired_count' , 0 ) self . view . settings ( ) . set ( 'dired_count' , dired_count + len ( items ) ) else : # expanding empty folder, so notify that it is empty replacement = [ u'%s\t<empty>' % root ] self . view . set_read_only ( False ) self . view . replace ( edit , line , '\n' . join ( replacement ) ) self . view . set_read_only ( True ) self . view . settings ( ) . set ( 'dired_index' , self . index ) self . restore_marks ( marked ) self . restore_sels ( ( seled , [ self . sel ] ) ) self . view . run_command ( 'dired_call_vcs' , { 'path' : self . path } ) emit_event ( u'finish_refresh' , ( self . view . id ( ) , [ filename ] ) , view = self . view )