From 8f6d0c7b1bc14b0b850679bacfbe5ecc2f629e20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Mon, 24 Jan 2022 13:57:30 +0200
Subject: [PATCH 1/1] Gopher: Set item type to 1 when navigating to parent
As suggested in: gemini://ruario.flounder.online/gemlog/2022-01-19_Some_Gopher_improvements_for_Lagrange.gmi
res/about/version.gmi | 3 ++-
src/ui/documentwidget.c | 14 +++++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/res/about/version.gmi b/res/about/version.gmi
index a6a860f2..4d67bfe6 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -7,7 +7,8 @@
-* Fixed cancelling an input query. Now pressing Cancel will navigate back to the previous page as expected.
+* Fixed cancelling an input query. Now pressing Cancel will navigate back to the previous page as intended.
+* Gopher: Fixed navigating to parent. Set item type to 1 to show a gophermap and not the plain source.
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 93604225..4332ae8f 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -4309,9 +4309,17 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
if (parts.path.end[-1] == '/') break;
parts.path.end--;
}
postCommandf_Root(w->root,
"open url:%s",
cstr_Rangecc((iRangecc){ constBegin_String(d->mod.url), parts.path.end }));
iString *parentUrl = collectNewRange_String((iRangecc){ constBegin_String(d->mod.url),
parts.path.end });
if (equalCase_Rangecc(parts.scheme, "gopher")) {
/* Always go to a gophermap. */
iZap(parts);
init_Url(&parts, parentUrl);
if (parts.path.start && size_Range(&parts.path) >= 2) {
((char *) parts.path.start)[1] = '1';
}
}
postCommandf_Root(w->root, "open url:%s", cstr_String(parentUrl));
}
return iTrue;
}
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).