[BEHAVIOUR_FIXED] Fix a minor behaviour in shorcutmapper.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@214 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-06-01 15:22:11 +00:00
parent a3b344bbc2
commit b9256773b6
3 changed files with 7 additions and 6 deletions

View File

@ -55,7 +55,7 @@ void writeLog(const char *logFileName, const char *log2write)
fclose(f); fclose(f);
} }
std::string purgeMenuItemString(const char * menuItemStr) std::string purgeMenuItemString(const char * menuItemStr, bool keepAmpersand)
{ {
char cleanedName[64] = ""; char cleanedName[64] = "";
size_t j = 0; size_t j = 0;
@ -69,12 +69,13 @@ std::string purgeMenuItemString(const char * menuItemStr)
} }
else if (menuItemStr[k] == '&') else if (menuItemStr[k] == '&')
{ {
//skip if (keepAmpersand)
cleanedName[j++] = menuItemStr[k];
//else skip
} }
else else
{ {
cleanedName[j] = menuItemStr[k]; cleanedName[j++] = menuItemStr[k];
j++;
} }
} }
cleanedName[j] = 0; cleanedName[j] = 0;

View File

@ -26,6 +26,6 @@ void systemMessage(const char *title);
void printInt(int int2print); void printInt(int int2print);
void printStr(const char *str2print); void printStr(const char *str2print);
void writeLog(const char *logFileName, const char *log2write); void writeLog(const char *logFileName, const char *log2write);
std::string purgeMenuItemString(const char * menuItemStr); std::string purgeMenuItemString(const char * menuItemStr, bool keepAmpersand = false);
#endif //M30_IDE_COMMUN_H #endif //M30_IDE_COMMUN_H

View File

@ -6071,7 +6071,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
if (!csc.getName()[0]) if (!csc.getName()[0])
{ //no predefined name, get name from menu and use that { //no predefined name, get name from menu and use that
::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND); ::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND);
csc.setName(purgeMenuItemString(menuName).c_str()); csc.setName(purgeMenuItemString(menuName, true).c_str());
} }
} }