diff --git a/lib/external/pattern_language b/lib/external/pattern_language index 44204e27c..910b36a85 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit 44204e27ceadbe9b8b0218420205819d3375ec38 +Subproject commit 910b36a857f844a2b0f70ce272a8368a0861b998 diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 1f0abaffb..cc6883780 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -521,6 +521,10 @@ namespace hex::plugin::builtin { m_hexEditor.setHoverChangedCallback([this](u64 address, size_t size) { m_hoverHighlights->clear(); + + if (Region(address, size) == Region::Invalid()) + return; + for (const auto &[id, hoverFunction] : ImHexApi::HexEditor::impl::getHoveringFunctions()) { auto highlightedAddresses = hoverFunction(m_hexEditor.getProvider(), address, size); m_hoverHighlights->merge(highlightedAddresses); diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index a0c2e9626..71f0b149a 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -555,7 +555,7 @@ namespace hex::plugin::builtin { if (m_hasUnevaluatedChanges && m_runningEvaluators == 0 && m_runningParsers == 0) { m_hasUnevaluatedChanges = false; - auto code = m_textEditor.GetText(); + const auto &code = m_textEditor.GetText(); EventPatternEditorChanged::post(code); TaskManager::createBackgroundTask("hex.builtin.task.parsing_pattern"_lang, [this, code, provider](auto &){ diff --git a/plugins/ui/include/ui/hex_editor.hpp b/plugins/ui/include/ui/hex_editor.hpp index 94116413e..5e9e966cd 100644 --- a/plugins/ui/include/ui/hex_editor.hpp +++ b/plugins/ui/include/ui/hex_editor.hpp @@ -333,6 +333,7 @@ namespace hex::ui { ScrollPosition m_scrollPosition; Region m_frameStartSelectionRegion = Region::Invalid(); + Region m_hoveredRegion = Region::Invalid(); u16 m_bytesPerRow = 16; std::endian m_dataVisualizerEndianness = std::endian::little; diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index 498453855..742bc5867 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -669,7 +669,6 @@ namespace hex::ui { Region newHoveredCell = { byteAddress, bytesPerCell }; if (hoveredCell != newHoveredCell) { hoveredCell = newHoveredCell; - m_hoverChangedCallback(hoveredCell.address, hoveredCell.size); } } @@ -732,7 +731,6 @@ namespace hex::ui { Region newHoveredCell = { byteAddress, bytesPerCell }; if (hoveredCell != newHoveredCell) { hoveredCell = newHoveredCell; - m_hoverChangedCallback(hoveredCell.address, hoveredCell.size); } } @@ -824,7 +822,6 @@ namespace hex::ui { Region newHoveredCell = { address, data.advance }; if (hoveredCell != newHoveredCell) { hoveredCell = newHoveredCell; - m_hoverChangedCallback(hoveredCell.address, hoveredCell.size); } } } @@ -905,6 +902,11 @@ namespace hex::ui { ImHexApi::HexEditor::impl::setHoveredRegion(m_provider, hoveredCell); + if (m_hoveredRegion != hoveredCell) { + m_hoveredRegion = hoveredCell; + m_hoverChangedCallback(m_hoveredRegion.address, m_hoveredRegion.size); + } + m_shouldScrollToSelection = false; }