Skip to content

Commit d39e14b

Browse files
committed
BUG: SF#9: notepad.runMenuCommand ignores menu name
1 parent 8e652c8 commit d39e14b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

PythonScript/src/MenuManager.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ idx_t MenuManager::findPluginCommand(const TCHAR *pluginName, const TCHAR *menuO
846846
tstring thisMenuName = formatMenuName(strBuffer);
847847
if (NULL != mii.hSubMenu && 0 == _tcsicmp(pluginName, thisMenuName.c_str()))
848848
{
849-
retVal = findMenuCommand(mii.hSubMenu, NULL, menuOption);
849+
retVal = findMenuCommand(mii.hSubMenu, pluginName, NULL, menuOption);
850850
break;
851851
}
852852

@@ -908,7 +908,7 @@ idx_t MenuManager::findMenuCommand(const TCHAR *menuName, const TCHAR *menuOptio
908908
}
909909

910910
HMENU hMenuBar = ::GetMenu(m_hNotepad);
911-
idx_t retVal = findMenuCommand(hMenuBar, menuName, menuOption);
911+
idx_t retVal = findMenuCommand(hMenuBar, _T(""), menuName, menuOption);
912912

913913
if (retVal != 0)
914914
{
@@ -929,7 +929,7 @@ tstring MenuManager::formatMenuName(const TCHAR *name)
929929
return nameStr;
930930
}
931931

932-
idx_t MenuManager::findMenuCommand(HMENU hParentMenu, const TCHAR *menuName, const TCHAR *menuOption)
932+
idx_t MenuManager::findMenuCommand(HMENU hParentMenu, const TCHAR *parentMenuName, const TCHAR *menuName, const TCHAR *menuOption)
933933
{
934934
size_t iMenuItems = (size_t)GetMenuItemCount(hParentMenu);
935935
idx_t retVal = 0;
@@ -969,7 +969,7 @@ idx_t MenuManager::findMenuCommand(HMENU hParentMenu, const TCHAR *menuName, con
969969
}
970970
}
971971
}
972-
else
972+
else if(0 == _tcsicmp(parentMenuName, menuName))
973973
{
974974
TCHAR *context = NULL;
975975
TCHAR *name = _tcstok_s(strBuffer, _T("\t"), &context);
@@ -986,7 +986,7 @@ idx_t MenuManager::findMenuCommand(HMENU hParentMenu, const TCHAR *menuName, con
986986

987987
if (NULL != mii.hSubMenu)
988988
{
989-
retVal = findMenuCommand(mii.hSubMenu, menuName, menuOption);
989+
retVal = findMenuCommand(mii.hSubMenu, strBuffer, menuName, menuOption);
990990
// If we've found it in the sub menu (or within the sub menu)
991991
if (0 != retVal)
992992
break;

PythonScript/src/MenuManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class MenuManager
5252
idx_t findPluginCommand(const TCHAR *pluginName, const TCHAR *menuOption, bool refreshCache);
5353
idx_t findMenuCommand(const TCHAR *menuName, const TCHAR *menuOption, bool refreshCache);
5454

55-
idx_t findMenuCommand(HMENU parentMenu, const TCHAR *menuName, const TCHAR *menuOption);
55+
idx_t findMenuCommand(HMENU parentMenu, const TCHAR *parentMenuName, const TCHAR *menuName, const TCHAR *menuOption);
5656

5757
void updatePreviousScript(const char *filename);
5858
void updateShortcut(UINT cmdID, ShortcutKey* key);

0 commit comments

Comments
 (0)