OSDN Git Service

Fix an issue where filenames containing "&" are not displayed properly in the MDI...
authorJun Tajima <56220423+tjmprm77@users.noreply.github.com>
Tue, 23 Aug 2022 14:13:04 +0000 (23:13 +0900)
committerGitHub <noreply@github.com>
Tue, 23 Aug 2022 14:13:04 +0000 (23:13 +0900)
- Add processing to escape "&" in the MDI tab bar.
- Add TTS_NOPREFIX to the tooltip style.

Src/Common/MDITabBar.cpp

index 381766e..f6c7971 100644 (file)
@@ -56,7 +56,7 @@ BOOL CMDITabBar::Create(CMDIFrameWnd* pMainFrame)
        m_font.CreateFontIndirect(&ncm.lfMenuFont);
        SetFont(&m_font);
 
-       m_tooltips.Create(m_pMainFrame);
+       m_tooltips.Create(m_pMainFrame, TTS_NOPREFIX);
        m_tooltips.AddTool(this, _T(""));
 
        return TRUE;
@@ -305,6 +305,9 @@ void CMDITabBar::UpdateTabs()
                if (strTitle.GetLength() > nMaxTitleLength)
                        strTitle = strTitle.Left(nMaxTitleLength - 3) + _T("...");
 
+               // Escape the '&' to prevent it from being removed and underlining the next character in the string.
+               strTitle.Replace(_T("&"), _T("&&"));
+
                if (item == -1)
                {
                        tci.mask = TCIF_PARAM | TCIF_TEXT;