From 86499e58ee479870ecb086abba030c14324df1a0 Mon Sep 17 00:00:00 2001 From: IChooseYou Date: Tue, 3 Mar 2026 08:38:08 -0700 Subject: [PATCH] fix: remove value history cooldown hack, dismiss popup on clear The cooldown suppressed tracking for ~1s but the popup persisted showing stale "1h ago" values because applyDocument skips popup dismissal. Replaced with explicit dismissHistoryPopup() after clear+refresh so the popup is gone immediately. Value tracking resumes on the next async cycle with a clean baseline (m_refreshGen++ discards in-flight reads, m_prevPages.clear() prevents phantom diffs). --- src/controller.cpp | 9 +++++---- src/controller.h | 1 - src/editor.cpp | 5 +++++ src/editor.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 4e5471a..53cf2a6 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -602,8 +602,7 @@ void RcxController::refresh() { else if (m_doc->provider && m_doc->provider->isValid() && m_doc->provider->isLive()) prov = m_doc->provider.get(); - if (m_valueTrackCooldown > 0) --m_valueTrackCooldown; - if (m_trackValues && prov && m_valueTrackCooldown <= 0) { + if (m_trackValues && prov) { for (auto& lm : m_lastResult.meta) { if (lm.nodeIdx < 0 || lm.nodeIdx >= m_doc->tree.nodes.size()) continue; if (isSyntheticLine(lm) || lm.isContinuation) continue; @@ -1711,8 +1710,9 @@ void RcxController::showContextMenu(RcxEditor* editor, int line, int nodeIdx, m_refreshGen++; // discard in-flight async reads m_prevPages.clear(); // clean baseline for next read cycle m_changedOffsets.clear(); // no phantom change indicators - m_valueTrackCooldown = 5; // suppress tracking for ~1s refresh(); + for (auto* editor : m_editors) + editor->dismissHistoryPopup(); }); } menu.addSeparator(); @@ -1935,8 +1935,9 @@ void RcxController::showContextMenu(RcxEditor* editor, int line, int nodeIdx, m_refreshGen++; // discard in-flight async reads m_prevPages.clear(); // clean baseline for next read cycle m_changedOffsets.clear(); // no phantom change indicators - m_valueTrackCooldown = 5; // suppress tracking for ~1s refresh(); + for (auto* editor : m_editors) + editor->dismissHistoryPopup(); }); } menu.addSeparator(); diff --git a/src/controller.h b/src/controller.h index 797690a..71a80bc 100644 --- a/src/controller.h +++ b/src/controller.h @@ -183,7 +183,6 @@ private: QSet m_changedOffsets; QHash m_valueHistory; bool m_trackValues = true; - int m_valueTrackCooldown = 0; uint64_t m_refreshGen = 0; uint64_t m_readGen = 0; bool m_readInFlight = false; diff --git a/src/editor.cpp b/src/editor.cpp index ed8c1e2..d9b6972 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -1387,6 +1387,11 @@ void RcxEditor::showFindBar() { m_findPos = 0; } +void RcxEditor::dismissHistoryPopup() { + if (m_historyPopup) + static_cast(m_historyPopup)->dismiss(); +} + void RcxEditor::hideFindBar() { m_findBarContainer->setVisible(false); long docLen = m_sci->SendScintilla(QsciScintillaBase::SCI_GETLENGTH); diff --git a/src/editor.h b/src/editor.h index 407aeb6..04620e9 100644 --- a/src/editor.h +++ b/src/editor.h @@ -34,6 +34,7 @@ public: int currentNodeIndex() const; void scrollToNodeId(uint64_t nodeId); void showFindBar(); + void dismissHistoryPopup(); // ── Column span computation ── static ColumnSpan typeSpan(const LineMeta& lm, int typeW = kColType);