From ee93c7a1c55964eb31253ff330972127f650f88c Mon Sep 17 00:00:00 2001 From: White3ger <67337370+White3ger@users.noreply.github.com> Date: Thu, 28 Aug 2025 23:15:55 +0200 Subject: [PATCH 1/3] F1 browser help - home fallback When F1 browser help is enabled and someone press F1 while no command is selected, it will open the home.html instead. --- AGK/AgkIde/TextEditor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/AGK/AgkIde/TextEditor.cpp b/AGK/AgkIde/TextEditor.cpp index 8ab99abc..8e6c1273 100644 --- a/AGK/AgkIde/TextEditor.cpp +++ b/AGK/AgkIde/TextEditor.cpp @@ -933,7 +933,8 @@ void TextEditor::Help( void ) } } - if (strlen(cHelp) < 2) + bool bNoCommandHelp = strlen(cHelp) < 2; + if (bNoCommandHelp && pref.bBrowserHelp == false) return; //Try to find help. @@ -945,6 +946,14 @@ void TextEditor::Help( void ) getcwd(&curDir[0], MAX_PATH); #endif + if (bNoCommandHelp) + { + strcat(curDir, "/media/help/home.html"); + + agk::OpenBrowser(curDir); + return; + } + int index = tolower( char(cHelp[0]) ); uString usHelp = cHelp; usHelp.Lower(); From 0aa247bb615894ad6263a286ef341728d22500b5 Mon Sep 17 00:00:00 2001 From: White3ger <67337370+White3ger@users.noreply.github.com> Date: Fri, 29 Aug 2025 02:27:48 +0200 Subject: [PATCH 2/3] F1 browser help - home fallback (corrections) --- AGK/AgkIde/TextEditor.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/AGK/AgkIde/TextEditor.cpp b/AGK/AgkIde/TextEditor.cpp index 8e6c1273..abed4280 100644 --- a/AGK/AgkIde/TextEditor.cpp +++ b/AGK/AgkIde/TextEditor.cpp @@ -934,7 +934,7 @@ void TextEditor::Help( void ) } bool bNoCommandHelp = strlen(cHelp) < 2; - if (bNoCommandHelp && pref.bBrowserHelp == false) + if (bNoCommandHelp && !pref.bBrowserHelp) return; //Try to find help. @@ -967,7 +967,7 @@ void TextEditor::Help( void ) if (sKeyNext->m_cCommandPath.GetLength() > 0 ) { //built in help - if (pref.bBrowserHelp == false) { + if (!pref.bBrowserHelp) { processhelp((char*)sKeyNext->m_cCommandPath.GetStr(), true); ImGui::SetWindowFocus(ICON_MD_HELP " Help"); } @@ -979,7 +979,7 @@ void TextEditor::Help( void ) agk::OpenBrowser(curDir); } - break; + return; } } sKeyNext = sKeyNext->m_pNext; @@ -987,6 +987,12 @@ void TextEditor::Help( void ) } + if (pref.bBrowserHelp) //failed to find command; use home fallback for browser help + { + strcat(curDir, "/media/help/home.html"); + agk::OpenBrowser(curDir); + } + return; } From 63b0d5cc71477a3f6d0b4257148ee83f90ab6462 Mon Sep 17 00:00:00 2001 From: White3ger <67337370+White3ger@users.noreply.github.com> Date: Fri, 29 Aug 2025 22:50:36 +0200 Subject: [PATCH 3/3] F1 browser help for linux Enabled the pref setting for linux too (changes tested on ubuntu). --- AGK/AgkIde/Gui.cpp | 2 +- AGK/AgkIde/TextEditor.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/AGK/AgkIde/Gui.cpp b/AGK/AgkIde/Gui.cpp index 9f8fc84f..9d0da995 100644 --- a/AGK/AgkIde/Gui.cpp +++ b/AGK/AgkIde/Gui.cpp @@ -350,7 +350,7 @@ void ProcessPreferences(void) { pref.iRememberTabOrder = bTmp; if (ImGui::IsItemHovered()) ImGui::SetTooltip("Will remember the order of Visible tabs.\nNon-visible tabs will be in a-z order."); -#ifdef AGK_WINDOWS +#if defined(AGK_WINDOWS) || defined(AGK_LINUX) bTmp = pref.bBrowserHelp; ImGui::Checkbox("Enable F1 Browser Help", &bTmp); pref.bBrowserHelp = bTmp; diff --git a/AGK/AgkIde/TextEditor.cpp b/AGK/AgkIde/TextEditor.cpp index abed4280..f2a1b324 100644 --- a/AGK/AgkIde/TextEditor.cpp +++ b/AGK/AgkIde/TextEditor.cpp @@ -942,13 +942,16 @@ void TextEditor::Help( void ) #ifdef AGK_WINDOWS _getcwd(&curDir[0], MAX_PATH); +#elif defined(AGK_LINUX) + strcpy(curDir, "file://"); + getcwd(&curDir[7], MAX_PATH - 7); #else getcwd(&curDir[0], MAX_PATH); #endif if (bNoCommandHelp) { - strcat(curDir, "/media/help/home.html"); + strcat(curDir, "/media/Help/home.html"); agk::OpenBrowser(curDir); return; @@ -973,7 +976,7 @@ void TextEditor::Help( void ) } //browser help else { - strcat(curDir, "\\"); + strcat(curDir, "/"); strcat(curDir, (char*)sKeyNext->m_cCommandPath.GetStr()); agk::OpenBrowser(curDir); @@ -989,7 +992,7 @@ void TextEditor::Help( void ) if (pref.bBrowserHelp) //failed to find command; use home fallback for browser help { - strcat(curDir, "/media/help/home.html"); + strcat(curDir, "/media/Help/home.html"); agk::OpenBrowser(curDir); }