Fix macro recording twice for some commands

When recording a keyboard macro, some commands are added to the macro twice.
When later playing back the macro, they happen twice, which leads to incorrect edits.

Fixed commands:
* EDIT_CUT (Cut)
* EDIT_COPY (Copy)
* IDM_EDIT_LINE_UP (Move Up Current Line)
* IDM_EDIT_LINE_DOWN (Move Down Current Line)

Not fixed: issue 13722:
SEARCH_GOTOMATCHINGBRACE (Go to Matching Brace)

Fix #5217, fix #14634, close #14613
pull/14675/head
anatoly77g 2024-01-17 19:50:13 +02:00 committed by Don Ho
parent f09b653d19
commit 91074da46d
1 changed files with 8 additions and 5 deletions

View File

@ -4200,9 +4200,6 @@ void Notepad_plus::command(int id)
case IDM_FILE_RELOAD: case IDM_FILE_RELOAD:
case IDM_EDIT_UNDO: case IDM_EDIT_UNDO:
case IDM_EDIT_REDO: case IDM_EDIT_REDO:
case IDM_EDIT_CUT:
case IDM_EDIT_COPY:
//case IDM_EDIT_PASTE:
case IDM_EDIT_DELETE: case IDM_EDIT_DELETE:
case IDM_SEARCH_FINDNEXT : case IDM_SEARCH_FINDNEXT :
case IDM_SEARCH_FINDPREV : case IDM_SEARCH_FINDPREV :
@ -4224,8 +4221,6 @@ void Notepad_plus::command(int id)
case IDM_EDIT_TRANSPOSE_LINE: case IDM_EDIT_TRANSPOSE_LINE:
case IDM_EDIT_SPLIT_LINES: case IDM_EDIT_SPLIT_LINES:
case IDM_EDIT_JOIN_LINES: case IDM_EDIT_JOIN_LINES:
case IDM_EDIT_LINE_UP:
case IDM_EDIT_LINE_DOWN:
case IDM_EDIT_REMOVEEMPTYLINES: case IDM_EDIT_REMOVEEMPTYLINES:
case IDM_EDIT_REMOVEEMPTYLINESWITHBLANK: case IDM_EDIT_REMOVEEMPTYLINESWITHBLANK:
case IDM_EDIT_UPPERCASE: case IDM_EDIT_UPPERCASE:
@ -4379,6 +4374,14 @@ void Notepad_plus::command(int id)
_macro.push_back(recordedMacroStep(id)); _macro.push_back(recordedMacroStep(id));
break; break;
// No need to record the following commands: all they do is execute Scintilla commands, which are recorded instead.
case IDM_EDIT_CUT:
case IDM_EDIT_COPY:
case IDM_EDIT_PASTE:
case IDM_EDIT_LINE_UP:
case IDM_EDIT_LINE_DOWN:
break;
// The following 3 commands will insert date time string during the recording: // 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) // 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. // So we erase these 2 unwanted commanded for recording these 3 following commands.