From 17cdde3622cf989c38d26175fec6d5ed17f5d6da Mon Sep 17 00:00:00 2001 From: xomx Date: Sat, 12 Apr 2025 11:26:35 +0200 Subject: [PATCH] Fix Find dialog status text too left visual glitch Text was visible but positioned too left. This visual glitch was accented in Windows 11 due to its rounding-wnd-corners effect. Fix #16359, close #16415 --- .../src/ScintillaComponent/FindReplaceDlg.cpp | 19 ++++++++++++++----- .../src/ScintillaComponent/FindReplaceDlg.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 68e3cc574..8a4e37b6b 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -4152,7 +4152,7 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType) ::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd); } -void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, const wstring& tooltipMsg) +void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus status, const wstring& tooltipMsg) { if (_statusbarTooltipWnd) { @@ -4162,7 +4162,7 @@ void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, _statusbarTooltipMsg = tooltipMsg; - if (staus == FSNotFound) + if (status == FSNotFound) { if (!NppParameters::getInstance().getNppGUI()._muteSounds) ::MessageBeep(0xFFFFFFFF); @@ -4175,7 +4175,7 @@ void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, flashInfo.dwFlags = FLASHW_ALL; FlashWindowEx(&flashInfo); } - else if (staus == FSTopReached || staus == FSEndReached) + else if (status == FSTopReached || status == FSEndReached) { if (!isVisible()) { @@ -4191,8 +4191,17 @@ void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, if (isVisible()) { - _statusbarFindStatus = staus; - _statusBar.setOwnerDrawText(msg.c_str()); + _statusbarFindStatus = status; + if ((msg.length() > 0) && (msg.at(0) != L' ')) + { + // fix visual glitch (text is visible, but positioned too far to the left) + wstring msgSpaceIndented = L' ' + msg; + _statusBar.setOwnerDrawText(msgSpaceIndented.c_str()); + } + else + { + _statusBar.setOwnerDrawText(msg.c_str()); + } } } diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index e5092ad57..a3ad00c0a 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -405,7 +405,7 @@ public : void execSavedCommand(int cmd, uptr_t intValue, const std::wstring& stringValue); void clearMarks(const FindOption& opt); - void setStatusbarMessage(const std::wstring & msg, FindStatus staus, const std::wstring& tooltipMsg = L""); + void setStatusbarMessage(const std::wstring & msg, FindStatus status, const std::wstring& tooltipMsg = L""); void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView); std::wstring getScopeInfoForStatusBar(FindOption const *pFindOpt) const; Finder * createFinder();