Skip to content

Commit

Permalink
fix #72
Browse files Browse the repository at this point in the history
- keep menus also in case scripts are located just at a deeper nesting level
- avoid compiler warning about type conversion
  • Loading branch information
chcg committed Dec 23, 2023
1 parent 50fd498 commit b081788
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion PythonScript/src/MenuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, tstring& p
HANDLE hFound = FindFirstFile(searchPath.c_str(), &findData);
BOOL found = (hFound != INVALID_HANDLE_VALUE) ? TRUE : FALSE;
idx_t position = 0;
bool subDirScriptsFoundAllDirs = false;

while (found)
{
Expand All @@ -439,6 +440,8 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, tstring& p
}

bool subDirScriptsFound = findScripts(hSubmenu, basePathLength, searchPath);
subDirScriptsFoundAllDirs |= subDirScriptsFound;

if (subDirScriptsFound )
{
// startID = nextID;
Expand Down Expand Up @@ -468,6 +471,12 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, tstring& p

bool scriptsFound = (TRUE == found);

if(subDirScriptsFoundAllDirs)
{
//keep menu also in case scripts are found in a deeper nested submenu
scriptsFound = true;
}

while(found)
{
tstring fullFilename(path);
Expand Down Expand Up @@ -720,7 +729,7 @@ void MenuManager::reconfigure()
if (position < m_originalDynamicCount)
{
ShortcutKey sk;
BOOL hasKey = ::SendMessage(m_hNotepad, NPPM_GETSHORTCUTBYCMDID, static_cast<WPARAM>(m_funcItems[m_dynamicStartIndex + position - 1]._cmdID), reinterpret_cast<LPARAM>(&sk));
BOOL hasKey = static_cast<BOOL>(::SendMessage(m_hNotepad, NPPM_GETSHORTCUTBYCMDID, static_cast<WPARAM>(m_funcItems[m_dynamicStartIndex + position - 1]._cmdID), reinterpret_cast<LPARAM>(&sk)));

tstring menuTitle(filename);

Expand Down

0 comments on commit b081788

Please sign in to comment.