about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-05 19:55:41 +0100
committerhut <hut@lavabit.com>2010-03-06 15:26:22 +0100
commitb38fa661ad783505e54f4eb4b8529c7cf277ce17 (patch)
tree24da56f6d2a5ea3b7e71f4980b0e94dc4a9e6279
parenta2ebf4e247155c32b1d777f7eac80b4d5722bb54 (diff)
downloadranger-b38fa661ad783505e54f4eb4b8529c7cf277ce17.tar.gz
actions: traverse the tree, visiting each subtree
(with the key "]")
-rw-r--r--ranger/actions.py19
-rw-r--r--ranger/defaults/keys.py3
2 files changed, 22 insertions, 0 deletions
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))