diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-01-27 19:29:42 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-01-27 19:29:42 +0200 |
commit | f29cc9ed25a52b28b7d5650b0fd3dc16457c3e65 (patch) | |
tree | 632c60d68dd1f0c8bc3384e71604d29c9802fafb | |
parent | 180f8dbd9e05523d9a079471cc4416c4465c2edc (diff) |
DocumentWidget: Navigate to parent vs. index.gmi
index.gmi is typically identical to the directory itself, so don't go from `/index.gmi` to `/`, but skip directly to the parent directory.
-rw-r--r-- | src/ui/documentwidget.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 550777af..beff0f3f 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -4301,6 +4301,9 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
4301 | else if (equal_Command(cmd, "navigate.parent") && document_App() == d) { | 4301 | else if (equal_Command(cmd, "navigate.parent") && document_App() == d) { |
4302 | iUrl parts; | 4302 | iUrl parts; |
4303 | init_Url(&parts, d->mod.url); | 4303 | init_Url(&parts, d->mod.url); |
4304 | if (endsWith_Rangecc(parts.path, "/index.gmi")) { | ||
4305 | parts.path.end -= 9; /* This is the default index page. */ | ||
4306 | } | ||
4304 | /* Remove the last path segment. */ | 4307 | /* Remove the last path segment. */ |
4305 | if (size_Range(&parts.path) > 1) { | 4308 | if (size_Range(&parts.path) > 1) { |
4306 | if (parts.path.end[-1] == '/') { | 4309 | if (parts.path.end[-1] == '/') { |