From f22d23acb2c151a68ca5ba41a7de6cc6ed3261a0 Mon Sep 17 00:00:00 2001 From: toonn Date: Thu, 15 Jul 2021 23:37:58 +0200 Subject: history: Replace branching with min/max builtins --- ranger/container/history.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ranger/container/history.py b/ranger/container/history.py index 9361e373..d271176d 100644 --- a/ranger/container/history.py +++ b/ranger/container/history.py @@ -108,17 +108,11 @@ class History(object): raise HistoryEmptyException def back(self): - self.index -= 1 - if self.index < 0: - self.index = 0 + self.index = max(0, self.index - 1) return self.current() def move(self, n): - self.index += n - if self.index > len(self.history) - 1: - self.index = len(self.history) - 1 - if self.index < 0: - self.index = 0 + self.index = max(0, min(self.history - 1, self.index + n)) return self.current() def search(self, string, n): -- cgit 1.4.1-2-gfad0 ble class='tabs'> summary refs log blame commit diff stats
path: root/README
blob: e752c37a6cd71dbeb7291096b19c7b206df420e9 (plain) (tree)
1
2
3
4
5
6
7
8
9