diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 75ec994a..b69cb41e 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1970,7 +1970,7 @@ void Notepad_plus::checkMacroState() enableCommand(IDM_MACRO_STARTRECORDINGMACRO, !_recordingMacro, MENU | TOOLBAR); enableCommand(IDM_MACRO_STOPRECORDINGMACRO, _recordingMacro, MENU | TOOLBAR); enableCommand(IDM_MACRO_PLAYBACKRECORDEDMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR); - enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR); + enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro && !_recordingSaved, MENU | TOOLBAR); enableCommand(IDM_MACRO_RUNMULTIMACRODLG, (!_macro.empty() && !_recordingMacro) || !((NppParameters::getInstance())->getMacroList()).empty(), MENU | TOOLBAR); } diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index ada0c751..4231da7d 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -309,6 +309,7 @@ private: Macro _macro; bool _recordingMacro = false; bool _playingBackMacro = false; + bool _recordingSaved = false; RunMacroDlg _runMacroDlg; // For conflict detection when saving Macros or RunCommands diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index d1e69db7..1f0f2e6f 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -897,6 +897,7 @@ void Notepad_plus::command(int id) _subEditView.execute(SCI_STARTRECORD); _recordingMacro = true; } + _recordingSaved = false; checkMacroState(); break; } @@ -928,7 +929,11 @@ void Notepad_plus::command(int id) case IDM_MACRO_SAVECURRENTMACRO : { if (addCurrentMacro()) + { + _recordingSaved = true; _runMacroDlg.initMacroList(); + checkMacroState(); + } break; } case IDM_EDIT_FULLPATHTOCLIP : diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp index 7abb0f94..f6eef7e8 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp +++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp @@ -612,9 +612,10 @@ void Accelerator::updateMenuItemByCommand(CommandShortcut csc) { int cmdID = csc.getID(); - // Ensure that the menu item checks set prior to this update remain in affect. + // Ensure that the menu item checks set prior to this update remain in affect. + // Ensure that the menu item state is also maintained UINT cmdFlags = GetMenuState(_hAccelMenu, cmdID, MF_BYCOMMAND ); - cmdFlags = MF_BYCOMMAND | ((cmdFlags&MF_CHECKED) ? MF_CHECKED : MF_UNCHECKED); + cmdFlags = MF_BYCOMMAND | ((cmdFlags&MF_CHECKED) ? MF_CHECKED : MF_UNCHECKED) | ((cmdFlags&MF_DISABLED) ? MF_DISABLED : MF_ENABLED); ::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str()); }