From ecd479cc863024cc9dd44a5aef41223200753f11 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 9 Feb 2026 22:56:41 -0700 Subject: [PATCH] Step 187: in-editor help panel --- PROGRESS.md | 1 + editor/CMakeLists.txt | 7 +++++++ editor/src/main.cpp | 2 ++ editor/src/panels/HelpPanelWindow.h | 12 +++++++++++ editor/src/panels/MenuBarPanel.h | 4 ++++ editor/src/state/UIFlags.h | 1 + editor/tests/step187_integration_test.cpp | 14 +++++++++++++ editor/tests/step187_test.cpp | 25 +++++++++++++++++++++++ sprint6_plan.md | 2 +- 9 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 editor/src/panels/HelpPanelWindow.h create mode 100644 editor/tests/step187_integration_test.cpp create mode 100644 editor/tests/step187_test.cpp diff --git a/PROGRESS.md b/PROGRESS.md index 25550ac..d074ec7 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -534,4 +534,5 @@ Sprint 5 in progress. Step 141 (Emacs daemon with user config) done. Next: Step | 2026-02-10 | Codex | Step 184: First-run wizard (layout/theme/keybindings + get-started actions) wired on missing session. 2/2 tests pass (step184_test, step184_integration_test). | | 2026-02-10 | Codex | Step 185: Contextual feature hints with persistence + dismiss/disable. 2/2 tests pass (step185_test, step185_integration_test). | | 2026-02-10 | Codex | Step 186: Keyboard shortcut reference panel with filter and live bindings. 2/2 tests pass (step186_test, step186_integration_test). | +| 2026-02-10 | Codex | Step 187: In-editor help panel window wired from menu with Markdown renderer reuse. 2/2 tests pass (step187_test, step187_integration_test). | | 2026-02-10 | Codex | Step 166: Extract main.cpp into panel headers marked complete (already implemented). step166_test passes; file_limits_test 4/4 passes. | diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index b86e210..9e5acf8 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -1093,6 +1093,13 @@ add_executable(step186_integration_test tests/step186_integration_test.cpp) target_include_directories(step186_integration_test PRIVATE src) target_link_libraries(step186_integration_test PRIVATE nlohmann_json::nlohmann_json) +add_executable(step187_test tests/step187_test.cpp) +target_include_directories(step187_test PRIVATE src) + +add_executable(step187_integration_test tests/step187_integration_test.cpp) +target_include_directories(step187_integration_test PRIVATE src) +target_link_libraries(step187_integration_test PRIVATE nlohmann_json::nlohmann_json) + find_package(SDL2 CONFIG REQUIRED) find_package(OpenGL REQUIRED) find_package(glad CONFIG REQUIRED) diff --git a/editor/src/main.cpp b/editor/src/main.cpp index 8389c47..308f772 100644 --- a/editor/src/main.cpp +++ b/editor/src/main.cpp @@ -29,6 +29,7 @@ #include "panels/EditorPanel.h" #include "panels/BottomPanel.h" #include "panels/StatusBarPanel.h" +#include "panels/HelpPanelWindow.h" static std::string emacsChordForEvent(SDL_Keycode sym, Uint16 mods) { std::string base; @@ -383,6 +384,7 @@ int main(int, char**) { renderFeatureHintBar(state.featureHints, state.workspaceRoot); static ShortcutReferenceState shortcutPanel; renderShortcutReference(state, shortcutPanel); + renderHelpPanelWindow(state); state.notifications.renderHistoryWindow([&](const Notification& note) { if (note.hasTarget) state.navigateToTarget(note.target); }); diff --git a/editor/src/panels/HelpPanelWindow.h b/editor/src/panels/HelpPanelWindow.h new file mode 100644 index 0000000..81b93ff --- /dev/null +++ b/editor/src/panels/HelpPanelWindow.h @@ -0,0 +1,12 @@ +#pragma once + +#include "../EditorState.h" + +static void renderHelpPanelWindow(EditorState& state) { + if (!state.ui.showHelpPanel) return; + ImGui::Begin("Documentation", &state.ui.showHelpPanel); + ImGui::PushFont(state.uiFont); + renderHelpPanel(state.helpPanel, state.workspaceRoot, state.monoFont); + ImGui::PopFont(); + ImGui::End(); +} diff --git a/editor/src/panels/MenuBarPanel.h b/editor/src/panels/MenuBarPanel.h index ac46d4f..4ed2008 100644 --- a/editor/src/panels/MenuBarPanel.h +++ b/editor/src/panels/MenuBarPanel.h @@ -210,6 +210,10 @@ static void renderMenuBar(EditorState& state) { } ImGui::EndMenu(); } + if (ImGui::BeginMenu("Help")) { + ImGui::MenuItem("Documentation", nullptr, &state.ui.showHelpPanel); + ImGui::EndMenu(); + } const bool canProject = state.activeAST() != nullptr; ImGui::SameLine(); diff --git a/editor/src/state/UIFlags.h b/editor/src/state/UIFlags.h index f4f94c0..6dfec8a 100644 --- a/editor/src/state/UIFlags.h +++ b/editor/src/state/UIFlags.h @@ -11,6 +11,7 @@ struct UIFlags { bool showSettingsPanel = false; bool showFirstRunWizard = false; bool showShortcutReference = false; + bool showHelpPanel = false; int bottomTab = 0; // 0=Output,1=AST,2=Highlighted LayoutPreset layoutPreset = LayoutPreset::VSCode; }; diff --git a/editor/tests/step187_integration_test.cpp b/editor/tests/step187_integration_test.cpp new file mode 100644 index 0000000..61764e8 --- /dev/null +++ b/editor/tests/step187_integration_test.cpp @@ -0,0 +1,14 @@ +// Step 187: Help panel flag integration checks. + +#include + +#include "state/UIFlags.h" + +int main() { + UIFlags flags; + flags.showHelpPanel = true; + assert(flags.showHelpPanel == true); + + printf("step187_integration_test: all assertions passed\n"); + return 0; +} diff --git a/editor/tests/step187_test.cpp b/editor/tests/step187_test.cpp new file mode 100644 index 0000000..0d7a34a --- /dev/null +++ b/editor/tests/step187_test.cpp @@ -0,0 +1,25 @@ +// Step 187: In-editor help panel checks. + +#include +#include +#include + +static std::string readFile(const std::string& path) { + std::ifstream f(path); + if (!f.is_open()) return {}; + return std::string((std::istreambuf_iterator(f)), + std::istreambuf_iterator()); +} + +static void assertContains(const std::string& text, const std::string& needle) { + assert(text.find(needle) != std::string::npos); +} + +int main() { + const std::string help = readFile("src/panels/HelpPanelWindow.h"); + assertContains(help, "Documentation"); + assertContains(help, "renderHelpPanel"); + + printf("step187_test: all assertions passed\n"); + return 0; +} diff --git a/sprint6_plan.md b/sprint6_plan.md index 20b750a..1a9dcc1 100644 --- a/sprint6_plan.md +++ b/sprint6_plan.md @@ -272,7 +272,7 @@ without being annoying. - Export to printable HTML/PDF *New:* `ShortcutReference.h` -- [ ] **Step 187: In-editor help system** +- [x] **Step 187: In-editor help system** Help > Documentation opens a dockable panel: - Searchable documentation browser - Sections: Getting Started, Annotation Reference, Language Support,