From 4c328e32aa31da320516909575642258216581a2 Mon Sep 17 00:00:00 2001 From: Lionel Dricot Date: Thu, 31 Aug 2023 15:49:20 +0200 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20add=20history=20to=20itself?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- offpunk.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/offpunk.py b/offpunk.py index a57d925..e67fcc1 100755 --- a/offpunk.py +++ b/offpunk.py @@ -350,19 +350,16 @@ class GeminiClient(cmd.Cmd): def _update_history(self, url): # We never update while in sync_only - if self.sync_only: + # We don’t add history to itself. + if self.sync_only or not url or url == "list:///history": return - # We don’t add lists to history - if not url or os.path.join(_DATA_DIR,"lists") in url: - return - histlist = self.get_list("history") links = self.list_get_links("history") - # avoid duplicate length = len(links) - if length > self.options["history_size"]: - length = self.options["history_size"] + #Don’t update history if we are back/forwarding through it if length > 0 and links[self.hist_index] == url: return + if length > self.options["history_size"]: + length = self.options["history_size"] self.list_add_top("history",limit=self.options["history_size"],truncate_lines=self.hist_index) self.hist_index = 0