def cd(self, defx: Defx, source_name: str, path: str, cursor: int) -> None: history = defx._cursor_history # Save previous cursor position candidate = self.get_cursor_candidate(cursor) if candidate: history[defx._cwd] = candidate['action__path'] global_histories = self._vim.vars['defx#_histories'] global_histories.append([defx._source.name, defx._cwd]) self._vim.vars['defx#_histories'] = global_histories if source_name != defx._source.name: if source_name not in self._all_sources: error(self._vim, 'Invalid source_name:' + source_name) return # Replace with new defx self._defxs[defx._index] = Defx(self._vim, self._context, self._all_sources[source_name], path, defx._index) defx = self._defxs[defx._index] defx.cd(path) self.redraw(True) self._check_session(defx._index, path) self._init_cursor(defx) if path in history: self.search_file(history[path], defx._index) self._update_paths(defx._index, path) self._vim.command('silent doautocmd <nomodeline> User DefxDirChanged')
def cd(self, defx: Defx, source_name: str, path: str, cursor: int) -> None: history = defx._cursor_history # Save previous cursor position candidate = self.get_cursor_candidate(cursor) if candidate: history[defx._cwd] = candidate['action__path'] global_histories = self._vim.vars['defx#_histories'] global_histories.append([defx._source.name, defx._cwd]) self._vim.vars['defx#_histories'] = global_histories if source_name != defx._source.name: # Replace with new defx self._defxs[defx._index] = Defx(self._vim, self._context, source_name, path, defx._index) defx = self._defxs[defx._index] defx.cd(path) self.redraw(True) self._check_session(defx._index, path) self._init_cursor(defx) if path in history: self.search_file(history[path], defx._index) self._update_paths(defx._index, path)
def cd(self, defx: Defx, path: str, cursor: int) -> None: # Save previous cursor position history = defx._cursor_history history[defx._cwd] = self.get_cursor_candidate(cursor)['action__path'] defx.cd(path) self.redraw(True) if path in history: self.search_file(history[path], defx._index) self._selected_candidates = []
def cd(self, defx: Defx, path: str, cursor: int) -> None: # Save previous cursor position history = defx._cursor_history history[defx._cwd] = self.get_cursor_candidate(cursor)['action__path'] global_histories = self._vim.vars['defx#_histories'] global_histories.append(defx._cwd) self._vim.vars['defx#_histories'] = global_histories defx.cd(path) self.redraw(True) self.init_cursor(defx) if path in history: self.search_file(history[path], defx._index) self.update_paths(defx._index, path)