Skip to content

Commit

Permalink
added internal status isHoverTextSuppressed to avoid flickering if Ed…
Browse files Browse the repository at this point in the history
…it is opened
  • Loading branch information
daddel80 committed Dec 25, 2024
1 parent f00e11a commit 8261bba
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/MultiReplacePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,14 @@ void MultiReplace::editTextAt(int itemIndex, ColumnID columnID) {
return; // Invalid ColumnID, exit the function
}

// Suppress hover text only while editing
isHoverTextSuppressed = true;

// Also remove LVS_EX_INFOTIP style from the ListView itself
DWORD extendedStyle = ListView_GetExtendedListViewStyle(_replaceListView);
extendedStyle &= ~LVS_EX_INFOTIP;
ListView_SetExtendedListViewStyle(_replaceListView, extendedStyle);

// Calculate the total width of previous columns to get the X coordinate for the start of the selected column
int totalWidthBeforeColumn = 0;
for (int i = 0; i < column; ++i) {
Expand Down Expand Up @@ -2145,6 +2153,19 @@ void MultiReplace::closeEditField(bool commitChanges) {
_editingItemIndex = -1;
_editingColumnIndex = -1;
_editingColumnID = ColumnID::INVALID;

// Restore hover text only if we suppressed it
if (isHoverTextSuppressed)
{
isHoverTextSuppressed = false;

// If user has hover text enabled in general, re-add LVS_EX_INFOTIP
if (isHoverTextEnabled) {
DWORD extendedStyle = ListView_GetExtendedListViewStyle(_replaceListView);
extendedStyle |= LVS_EX_INFOTIP;
ListView_SetExtendedListViewStyle(_replaceListView, extendedStyle);
}
}
}

LRESULT CALLBACK MultiReplace::EditControlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
Expand Down Expand Up @@ -2279,7 +2300,7 @@ LRESULT CALLBACK MultiReplace::ListViewSubclassProc(HWND hwnd, UINT msg, WPARAM

case WM_MOUSEMOVE: {

if (!pThis->isHoverTextEnabled) {
if (!pThis->isHoverTextEnabled || pThis->isHoverTextSuppressed) {
return CallWindowProc(pThis->originalListViewProc, hwnd, msg, wParam, lParam);
}

Expand Down Expand Up @@ -2318,7 +2339,7 @@ LRESULT CALLBACK MultiReplace::ListViewSubclassProc(HWND hwnd, UINT msg, WPARAM
case WM_TIMER: {
if (wParam == 1) { // Tooltip re-enable timer
KillTimer(hwnd, 1); // Kill the timer first to prevent it from firing again
if (!pThis->isHoverTextEnabled) {
if (!pThis->isHoverTextEnabled || pThis->isHoverTextSuppressed) {
return 0;
}
// Re-enable LVS_EX_INFOTIP
Expand Down
1 change: 1 addition & 0 deletions src/MultiReplacePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ class MultiReplace : public StaticDialog
int lastMouseX;
int lastMouseY;
bool isHoverTextEnabled = false; // Important to set on false as TIMER will be triggered at startup.
bool isHoverTextSuppressed = false; // Temporarily supress HoverText to avoid flickering wehn Edit in list is open

// GUI control-related constants
const int maxHistoryItems = 10; // Maximum number of history items to be saved for Find/Replace
Expand Down

0 comments on commit 8261bba

Please sign in to comment.