diff --git a/.gitignore b/.gitignore index be9e97d76..97ec6d686 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ cmake-build-*/ build*/ local/ venv/ +.cache/ *.mgc *.kdev4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 75dee6f3f..c3ad66f23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ include("${IMHEX_BASE_FOLDER}/cmake/ide_helpers.cmake") # Basic compiler and cmake configurations set(CMAKE_CXX_STANDARD 23) set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake") # Setup project diff --git a/lib/external/pattern_language b/lib/external/pattern_language index a210503da..432904c30 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit a210503daf9f906578ec3c31484e489e5980933a +Subproject commit 432904c30bc2db346799afe2fa46e0984a49a9e6 diff --git a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp index e6b109b3b..2cd6d0281 100644 --- a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp +++ b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp @@ -1322,8 +1322,6 @@ void TextEditor::EnterCharacter(ImWchar aChar, bool aShift) { auto coord = GetActualCursorCoordinates(); u.mAddedStart = coord; - assert(!mLines.empty()); - if (aChar == '\n') { InsertLine(coord.mLine + 1); auto &line = mLines[coord.mLine]; diff --git a/main/gui/source/window/linux_window.cpp b/main/gui/source/window/linux_window.cpp index c7e6d8130..be7df68dd 100644 --- a/main/gui/source/window/linux_window.cpp +++ b/main/gui/source/window/linux_window.cpp @@ -74,7 +74,7 @@ namespace hex { && FcPatternGetString(font, FC_FAMILY, 0, &fullName) != FcResultMatch) { continue; } - + registerFont(reinterpret_cast(fullName), reinterpret_cast(file)); } @@ -123,7 +123,7 @@ namespace hex { glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); #if defined(GLFW_WAYLAND_APP_ID) - glfwWindowHintString(GLFW_WAYLAND_APP_ID, "imhex"); + glfwWindowHintString(GLFW_WAYLAND_APP_ID, "imhex"); #endif } @@ -190,4 +190,4 @@ namespace hex { } -#endif \ No newline at end of file +#endif diff --git a/plugins/builtin/include/content/views/view_pattern_editor.hpp b/plugins/builtin/include/content/views/view_pattern_editor.hpp index da7afbaac..3deb72759 100644 --- a/plugins/builtin/include/content/views/view_pattern_editor.hpp +++ b/plugins/builtin/include/content/views/view_pattern_editor.hpp @@ -251,7 +251,7 @@ namespace hex::plugin::builtin { PerProvider m_cursorPosition; PerProvider> m_lastEvaluationError; PerProvider> m_lastCompileError; - PerProvider> m_callStack; + PerProvider>*> m_callStack; PerProvider> m_lastEvaluationOutVars; PerProvider> m_patternVariables; PerProvider> m_sections; diff --git a/plugins/builtin/source/content/pl_pragmas.cpp b/plugins/builtin/source/content/pl_pragmas.cpp index c9b4bd94a..d75b49bd7 100644 --- a/plugins/builtin/source/content/pl_pragmas.cpp +++ b/plugins/builtin/source/content/pl_pragmas.cpp @@ -9,7 +9,7 @@ namespace hex::plugin::builtin { void registerPatternLanguagePragmas() { - ContentRegistry::PatternLanguage::addPragma("base_address", [](const pl::PatternLanguage &runtime, const std::string &value) { + ContentRegistry::PatternLanguage::addPragma("base_address", [](pl::PatternLanguage &runtime, const std::string &value) { auto baseAddress = strtoull(value.c_str(), nullptr, 0); ImHexApi::Provider::get()->setBaseAddress(baseAddress); @@ -27,4 +27,4 @@ namespace hex::plugin::builtin { }); } -} \ No newline at end of file +} diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 1bac9ff0e..1521544c5 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -1343,8 +1343,8 @@ namespace hex::plugin::builtin { }; TextEditor::ErrorMarkers errorMarkers; - if (!m_callStack->empty()) { - for (const auto &frame : *m_callStack | std::views::reverse) { + if (!(*m_callStack)->empty()) { + for (const auto &frame : **m_callStack | std::views::reverse) { auto location = frame->getLocation(); std::string message; if (location.source->source == pl::api::Source::DefaultSource) { @@ -1806,7 +1806,7 @@ namespace hex::plugin::builtin { if (!m_lastEvaluationResult) { *m_lastEvaluationError = runtime.getEvalError(); *m_lastCompileError = runtime.getCompileErrors(); - *m_callStack = reinterpret_cast &>(runtime.getInternals().evaluator->getCallStack()); + *m_callStack = &runtime.getInternals().evaluator->getCallStack(); } TaskManager::doLater([code] { diff --git a/plugins/ui/include/ui/pattern_drawer.hpp b/plugins/ui/include/ui/pattern_drawer.hpp index 189293b0e..c4dc352ad 100644 --- a/plugins/ui/include/ui/pattern_drawer.hpp +++ b/plugins/ui/include/ui/pattern_drawer.hpp @@ -130,5 +130,6 @@ namespace hex::ui { std::function m_hoverCallback = [](const pl::ptrn::Pattern *) { }; pl::gen::fmt::FormatterArray m_formatters; + u64 m_lastRunId = 0; }; } \ No newline at end of file diff --git a/plugins/ui/source/ui/pattern_drawer.cpp b/plugins/ui/source/ui/pattern_drawer.cpp index 9dca60a6f..017c31a63 100644 --- a/plugins/ui/source/ui/pattern_drawer.cpp +++ b/plugins/ui/source/ui/pattern_drawer.cpp @@ -1214,6 +1214,16 @@ namespace hex::ui { } void PatternDrawer::draw(const std::vector> &patterns, const pl::PatternLanguage *runtime, float height) { + if (runtime == nullptr) { + this->reset(); + } else { + auto runId = runtime->getRunId(); + if (runId != m_lastRunId) { + this->reset(); + m_lastRunId = runId; + } + } + std::scoped_lock lock(s_resetDrawMutex); m_hoverCallback(nullptr);