From f455c5ad185f218a58f4b22edc4fc040b75426b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Fri, 7 May 2021 14:37:00 +0300 Subject: [PATCH 1/4] Cleanup --- src/app.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app.c b/src/app.c index 4365f77d1..3b6752deb 100644 --- a/src/app.c +++ b/src/app.c @@ -1445,8 +1445,8 @@ static void updatePrefsThemeButtons_(iWidget *d) { } static void updatePrefsPinSplitButtons_(iWidget *d, int value) { - for (size_t i = 0; i < 3; i++) { - setFlags_Widget(findChild_Widget(d, format_CStr("prefs.pinsplit.%u", i)), + for (int i = 0; i < 3; i++) { + setFlags_Widget(findChild_Widget(d, format_CStr("prefs.pinsplit.%d", i)), selected_WidgetFlag, i == value); } @@ -1588,7 +1588,7 @@ iDocumentWidget *document_Command(const char *cmd) { } iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNew) { - iApp *d = &app_; + //iApp *d = &app_; iWidget *tabs = findWidget_Root("doctabs"); setFlags_Widget(tabs, hidden_WidgetFlag, iFalse); iWidget *newTabButton = findChild_Widget(tabs, "newtab"); From 18ee42831adeb97f6cee606f1fe37d790c977f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Fri, 7 May 2021 16:12:06 +0300 Subject: [PATCH 2/4] Window: First move with custom frame may be cancelled Use of uninitialized memory. --- src/ui/window.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/window.c b/src/ui/window.c index aacb5f9ba..f1e89344f 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -412,6 +412,7 @@ void init_Window(iWindow *d, iRect rect) { d->place.initialPos = rect.pos; d->place.normalRect = rect; d->place.lastNotifiedSize = zero_I2(); + d->place.snap = 0; d->pendingCursor = NULL; d->isDrawFrozen = iTrue; d->isExposed = iFalse; From 3042883598c9db1436a63788f40604ce41a0b801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Fri, 7 May 2021 16:12:47 +0300 Subject: [PATCH 3/4] Updated the_Foundation --- lib/the_Foundation | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/the_Foundation b/lib/the_Foundation index dd4bc4daa..5c16edb45 160000 --- a/lib/the_Foundation +++ b/lib/the_Foundation @@ -1 +1 @@ -Subproject commit dd4bc4daa9f25b1b6a3411c43472bc24eaaf33c0 +Subproject commit 5c16edb45041080715ceb527a093ce6e97ce1a62 From 04cec8bb69f5afc2883235aa8fd0a329671279be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Fri, 7 May 2021 16:13:05 +0300 Subject: [PATCH 4/4] Windows: Fixed use of native path separators `GmRequest` should use the correct path separators on Windows in native paths. --- src/gmrequest.c | 15 ++++++++++----- src/gmutil.c | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gmrequest.c b/src/gmrequest.c index 1a7c37df7..3dd92eecb 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c @@ -597,16 +597,18 @@ void submit_GmRequest(iGmRequest *d) { else if (equalCase_Rangecc(url.scheme, "file")) { /* TODO: Move handling of "file://" URLs elsewhere, it's getting complex. */ iString *path = collect_String(localFilePathFromUrl_String(&d->url)); + /* Note: As a local file path, `path` uses the OS directory separators + (i.e., \ on Windows). `Archive` accepts both. */ iFile *f = new_File(path); if (isDirectory_(path)) { - if (endsWith_String(path, "/")) { + if (endsWith_String(path, iPathSeparator)) { removeEnd_String(path, 1); } resp->statusCode = success_GmStatusCode; setCStr_String(&resp->meta, "text/gemini"); iString *page = collectNew_String(); iString *parentDir = collectNewRange_String(dirName_Path(path)); - appendFormat_String(page, "=> %s " upArrow_Icon " %s/\n\n", + appendFormat_String(page, "=> %s " upArrow_Icon " %s" iPathSeparator "\n\n", cstrCollect_String(makeFileUrl_String(parentDir)), cstr_String(parentDir)); appendFormat_String(page, "# %s\n", cstr_Rangecc(baseName_Path(path))); @@ -630,7 +632,7 @@ void submit_GmRequest(iGmRequest *d) { appendFormat_String(page, "=> %s %s%s\n", cstrCollect_String(makeFileUrl_String(path_FileInfo(entry))), cstr_Rangecc(baseName_Path(path_FileInfo(entry))), - isDirectory_FileInfo(entry) ? "/" : ""); + isDirectory_FileInfo(entry) ? iPathSeparator : ""); iRelease(entry); } set_Block(&resp->body, utf8_String(page)); @@ -652,7 +654,8 @@ void submit_GmRequest(iGmRequest *d) { iString *entryPath = collect_String(copy_String(path)); remove_Block(&entryPath->chars, 0, size_String(container) + 1); /* last slash, too */ iBool isDir = isDirectory_Archive(arch, entryPath); - if (isDir && !isEmpty_String(entryPath) && !endsWith_String(entryPath, "/")) { + if (isDir && !isEmpty_String(entryPath) && + !endsWith_String(entryPath, iPathSeparator)) { /* Must have a slash for directories, otherwise relative navigation will not work. */ resp->statusCode = redirectPermanent_GmStatusCode; @@ -683,7 +686,9 @@ void submit_GmRequest(iGmRequest *d) { const iRangecc parentDir = dirName_Path(collectNewRange_String(curDir)); if (!equal_Rangecc(parentDir, ".")) { /* A subdirectory. */ - appendFormat_String(page, "=> ../ " upArrow_Icon " %s/\n", + appendFormat_String(page, + "=> ../ " upArrow_Icon " %s" iPathSeparator + "\n", cstr_Rangecc(parentDir)); } else { diff --git a/src/gmutil.c b/src/gmutil.c index 2a4f47284..718a0a9ae 100644 --- a/src/gmutil.c +++ b/src/gmutil.c @@ -439,6 +439,7 @@ iString *localFilePathFromUrl_String(const iString *d) { if (startsWith_String(path, "/")) { remove_Block(&path->chars, 0, 1); } + replace_Block(&path->chars, '/', '\\'); #endif return path; }