summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-01 23:42:54 +0100
committerhut <hut@lavabit.com>2010-01-01 23:42:54 +0100
commite19f991553b17e9eb07124952682cd11a1ab1303 (patch)
treeda291a891cd5f7928b5e811ccbcf8af9fa04834d
parenta56455bd596733236df37a88267489f7e17fb466 (diff)
downloadranger-e19f991553b17e9eb07124952682cd11a1ab1303.tar.gz
actions: fixed cycling
-rw-r--r--ranger/actions.py4
-rw-r--r--ranger/fsobject/directory.py4
2 files changed, 5 insertions, 3 deletions
diff --git a/ranger/actions.py b/ranger/actions.py
index 0d8472cd..9b877e71 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -13,6 +13,7 @@ class Actions(EnvironmentAware, SettingsAware):
 	search_forward = False
 
 	def search(self, order=None, forward=True):
+		original_order = order
 		if self.search_forward:
 			direction = bool(forward)
 		else:
@@ -39,7 +40,7 @@ class Actions(EnvironmentAware, SettingsAware):
 
 		elif order in ('size', 'mimetype', 'ctime'):
 			pwd = self.env.pwd
-			if not pwd.cycle_list:
+			if original_order is not None:
 				lst = list(pwd.files)
 				if order == 'size':
 					fnc = lambda item: item.size
@@ -49,6 +50,7 @@ class Actions(EnvironmentAware, SettingsAware):
 					fnc = lambda item: -int(item.stat and item.stat.st_ctime)
 				lst.sort(key=fnc)
 				pwd.set_cycle_list(lst)
+				return pwd.cycle(forward=None)
 
 			return pwd.cycle(forward=forward)
 
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 71afa06a..5ff768fb 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -283,9 +283,9 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 
 	def cycle(self, forward=True):
 		if self.cycle_list:
-			if forward:
+			if forward is True:
 				self.cycle_list.rotate(-1)
-			else:
+			elif forward is False:
 				self.cycle_list.rotate(1)
 
 			self.move_to_obj(self.cycle_list[0])