~earboxer/browset

50c38b6113214a9c29ba870f16adda29ed95c317 — Zach DeCook 1 year, 1 month ago 3a6a397
soon button (forward): implement functionality
1 files changed, 11 insertions(+), 2 deletions(-)

M browset.py
M browset.py => browset.py +11 -2
@@ 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