diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 8333456ae..71bfb5721 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3868,5 +3868,27 @@ void Notepad_plus::command(int id) case IDM_VIEW_IN_IE : _macro.push_back(recordedMacroStep(id)); break; + + // The following 3 commands will insert date time string during the recording: + // SCI_REPLACESEL will be recorded firstly, then SCI_ADDTEXT (for adding date time string) + // So we erase these 2 unwanted commanded for recording these 3 following commands. + case IDM_EDIT_INSERT_DATETIME_SHORT: + case IDM_EDIT_INSERT_DATETIME_LONG: + case IDM_EDIT_INSERT_DATETIME_CUSTOMIZED: + { + size_t lastIndex = _macro.size(); + if (lastIndex >= 2) + { + --lastIndex; + if (_macro[lastIndex]._message == SCI_ADDTEXT && _macro[lastIndex - 1]._message == SCI_REPLACESEL) + { + _macro.erase(_macro.begin() + lastIndex); + --lastIndex; + _macro.erase(_macro.begin() + lastIndex); + } + } + _macro.push_back(recordedMacroStep(id)); + } + break; } } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index e8444050a..f91d92e64 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -146,6 +146,9 @@ static const WinMenuKeyDefinition winKeyDefs[] = { VK_SPACE, IDM_EDIT_AUTOCOMPLETE_PATH, true, true, false, nullptr }, { VK_RETURN, IDM_EDIT_AUTOCOMPLETE_CURRENTFILE, true, false, false, nullptr }, { VK_SPACE, IDM_EDIT_FUNCCALLTIP, true, false, true, nullptr }, + { VK_NULL, IDM_EDIT_INSERT_DATETIME_SHORT, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_INSERT_DATETIME_LONG, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_INSERT_DATETIME_CUSTOMIZED, false, false, false, nullptr }, { VK_NULL, IDM_FORMAT_TODOS, false, false, false, TEXT("EOL Conversion to Windows (CR LF)") }, { VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, TEXT("EOL Conversion to Unix (LF)") }, { VK_NULL, IDM_FORMAT_TOMAC, false, false, false, TEXT("EOL Conversion to Macintosh (CR)") },