impr: Optimize hovering over patterns in the hex editor
This commit is contained in:
parent
a7115d4300
commit
60663babc8
2
lib/external/pattern_language
vendored
2
lib/external/pattern_language
vendored
@ -1 +1 @@
|
||||
Subproject commit 44204e27ceadbe9b8b0218420205819d3375ec38
|
||||
Subproject commit 910b36a857f844a2b0f70ce272a8368a0861b998
|
@ -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);
|
||||
|
@ -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 &){
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user