summary refs log tree commit diff
path: root/browset.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2023-01-03 12:42:10 -0500
committerZach DeCook <zachdecook@librem.one>2023-01-03 12:42:10 -0500
commit50c38b6113214a9c29ba870f16adda29ed95c317 (patch)
tree5e73407189d3325aa6ee4729c8376f1038fabaef /browset.py
parent3a6a39730df0a6b0d6efa4f8606824b3a61322cf (diff)
downloadbrowset-50c38b6113214a9c29ba870f16adda29ed95c317.tar.gz
soon button (forward): implement functionality
Diffstat (limited to 'browset.py')
-rwxr-xr-xbrowset.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/browset.py b/browset.py
index 30d51b3..739e894 100755
--- a/browset.py
+++ b/browset.py
@@ -14,6 +14,7 @@ class Browset(App):
         Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True),
     ]
     history = []
+    fistory = [] # forward history
 
     content = ["#h1", "## hey [b]Is this unformatted?[/b]", "```startpre","in preformatted text this hsould have a scrollbar if it is too wide oh yeah tonight is gonna be great.", "``` (ended pre)", "afterward"]
     def compose(self) -> ComposeResult:
@@ -37,14 +38,22 @@ class Browset(App):
             self._do_url(self.url)
         elif event.button.name == 'back':
           if len(self.history):
-            self._do_url(self.history.pop(), histore=False)
+            self.fistory.append(self.url)
+            url = self.history.pop()
+            self._do_url(url, histore=False, clearF=False)
+        elif event.button.name == 'soon':
+          if len(self.fistory):
+            url = self.fistory.pop()
+            self._do_url(url, clearF=False)
       else:
         url = event.button.name
         if not ":" in url:
             url = GeminiProtocol.relativeURL(url, self.url)
         self._do_url(url)
         
-    def _do_url(self, url, histore=True, setbar=True):
+    def _do_url(self, url, histore=True, setbar=True, clearF=True):
+        if clearF:
+            self.fistory = []
         if setbar:
             input = self.query_one("#url")
             input.value = url