From b38fa661ad783505e54f4eb4b8529c7cf277ce17 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 5 Mar 2010 19:55:41 +0100 Subject: actions: traverse the tree, visiting each subtree (with the key "]") --- ranger/actions.py | 19 +++++++++++++++++++ ranger/defaults/keys.py | 3 +++ 2 files changed, 22 insertions(+) diff --git a/ranger/actions.py b/ranger/actions.py index 604be298..c4b75aca 100644 --- a/ranger/actions.py +++ b/ranger/actions.py @@ -334,6 +334,25 @@ class Actions(EnvironmentAware, SettingsAware): cwd.unload() cwd.load_content() + def traverse(self): + cf = self.env.cf + cwd = self.env.pwd + if cf is not None and cf.is_directory: + self.enter_dir(cf.path) + elif cwd.pointer >= len(cwd) - 1: + while True: + self.enter_dir('..') + cwd = self.env.pwd + if cwd.pointer < len(cwd) - 1: + break + if cwd.path == '/': + break + self.move_pointer(1) + self.traverse() + else: + self.move_pointer(1) + self.traverse() + def set_filter(self, fltr): try: self.env.pwd.filter = fltr diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 89dd3d98..f5b2275f 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -60,6 +60,9 @@ def initialize_commands(command_list): bind(ctrl('d'), fm.move_pointer_by_pages(0.5)) bind(ctrl('u'), fm.move_pointer_by_pages(-0.5)) + bind(']', fm.traverse()) + bind('[', fm.history_go(-1)) + # --------------------------------------------------------- history bind('H', fm.history_go(-1)) bind('L', fm.history_go(1)) -- cgit 1.4.1-2-gfad0