aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-12-22 00:07:16 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-12-22 00:07:16 -0800
commitc537e7bc2d55fbc46a77f3e8e4f207acd522ea82 (patch)
tree24b8e5e5e1170a4e7a30046f1c9d077b26495c84
parente20f4644843688c1ec43527c2d9c18fc01184f7b (diff)
downloadteliva-c537e7bc2d55fbc46a77f3e8e4f207acd522ea82.tar.gz
gemini: back button
-rw-r--r--gemini.tlv8
1 files changed, 8 insertions, 0 deletions
diff --git a/gemini.tlv b/gemini.tlv
index aaee84b..79099a1 100644
--- a/gemini.tlv
+++ b/gemini.tlv
@@ -190,6 +190,7 @@
state:
>state = {
> lines={},
+ > history={},
> highlight_index=0,
> source=false, -- show source (link urls, etc.)
>}
@@ -235,6 +236,7 @@
menu:
>menu = {}
>menu['enter'] = 'go to highlight'
+ >menu['←'] = 'back'
>menu['^g'] = 'enter url'
>menu['^u'] = 'view source'
- __teliva_timestamp: original
@@ -316,6 +318,11 @@
> next_link()
> elseif key == 259 then -- up arrow
> previous_link()
+ > elseif key == 260 then -- left arrow
+ > if #state.history > 1 then
+ > table.remove(state.history)
+ > gemini_get(table.remove(state.history))
+ > end
> elseif key == 21 then -- ctrl-u
> state.source = not state.source
> elseif key == 10 then -- enter
@@ -480,6 +487,7 @@
> if status[1] == '2' then
> parse_gemini_body(conn, meta)
> state.url = url
+ > table.insert(state.history, url)
> elseif status[1] == '3' then
> gemini_get(socket.url.absolute(url, meta))
> elseif status[1] == '4' or line[1] == '5' then