impr: Optimize hovering over patterns in the hex editor

This commit is contained in:
WerWolv
2024-08-03 16:50:30 +02:00
parent a7115d4300
commit 60663babc8
5 changed files with 12 additions and 5 deletions

View File

@@ -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);

View File

@@ -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 &){