Broken project to implement a cross-protocol browser in textual
soon button (forward): implement functionality
| -rwxr-xr-x | browset.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |