Add Insert Date/Time commands shortcut & macro capacities

Fix #10567
pull/10576/head
Don Ho 3 years ago
parent c7e1da48ff
commit bc2e689185

@ -3868,5 +3868,27 @@ void Notepad_plus::command(int id)
case IDM_VIEW_IN_IE : case IDM_VIEW_IN_IE :
_macro.push_back(recordedMacroStep(id)); _macro.push_back(recordedMacroStep(id));
break; 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;
} }
} }

@ -146,6 +146,9 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_SPACE, IDM_EDIT_AUTOCOMPLETE_PATH, true, true, false, nullptr }, { VK_SPACE, IDM_EDIT_AUTOCOMPLETE_PATH, true, true, false, nullptr },
{ VK_RETURN, IDM_EDIT_AUTOCOMPLETE_CURRENTFILE, true, false, false, nullptr }, { VK_RETURN, IDM_EDIT_AUTOCOMPLETE_CURRENTFILE, true, false, false, nullptr },
{ VK_SPACE, IDM_EDIT_FUNCCALLTIP, true, false, true, 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_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_TOUNIX, false, false, false, TEXT("EOL Conversion to Unix (LF)") },
{ VK_NULL, IDM_FORMAT_TOMAC, false, false, false, TEXT("EOL Conversion to Macintosh (CR)") }, { VK_NULL, IDM_FORMAT_TOMAC, false, false, false, TEXT("EOL Conversion to Macintosh (CR)") },

Loading…
Cancel
Save