From e19f991553b17e9eb07124952682cd11a1ab1303 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 1 Jan 2010 23:42:54 +0100 Subject: actions: fixed cycling --- ranger/actions.py | 4 +++- ranger/fsobject/directory.py | 4 ++-- 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]) -- cgit 1.4.1-2-gfad0