Fix corrupted encoding text on status bar

Remove the shortcut text from the menu text that is used in status bar.

Fix #10146, close #10148
This commit is contained in:
mere-human 2021-07-13 22:02:23 +03:00 committed by Don Ho
parent 599f1852c7
commit 5e28b47ff8
1 changed files with 6 additions and 2 deletions

View File

@ -2620,15 +2620,19 @@ void Notepad_plus::setUniModeText()
int cmdID = em.getIndexFromEncoding(encoding);
if (cmdID == -1)
{
//printStr(TEXT("Encoding problem. Encoding is not added in encoding_table?"));
assert(!"Encoding problem. Encoding is not added in encoding_table?");
return;
}
cmdID += IDM_FORMAT_ENCODE;
const int itemSize = 64;
TCHAR uniModeText[itemSize];
TCHAR uniModeText[itemSize] = {};
::GetMenuString(_mainMenuHandle, cmdID, uniModeText, itemSize, MF_BYCOMMAND);
uniModeTextString = uniModeText;
// Remove the shortcut text from the menu text.
const size_t tabPos = uniModeTextString.find_last_of('\t');
if (tabPos != generic_string::npos)
uniModeTextString.resize(tabPos);
}
_statusBar.setText(uniModeTextString.c_str(), STATUSBAR_UNICODE_TYPE);
}