Add Insert Date/Time commands shortcut & macro capacities

Fix #10567
This commit is contained in:
Don Ho 2021-09-20 04:11:45 +02:00
parent c7e1da48ff
commit bc2e689185
2 changed files with 25 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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)") },