diff --git a/Versions/build.txt b/Versions/build.txt index fc45a032c..0b9ab6eaa 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2604 +2605 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 39ff28c11..4585c131b 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/src/Edit.c b/src/Edit.c index cc1394a8f..78d63c483 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -2749,6 +2749,8 @@ void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation, bool bForceAll return; } + _BEGIN_UNDO_ACTION_ + DocPos const iInitialPos = SciCall_GetCurrentPos(); if (bForceAll) { SciCall_SelectAll(); } @@ -2820,6 +2822,8 @@ void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation, bool bForceAll else { EditSetSelectionEx(hwnd, iInitialPos, iInitialPos, -1, -1); } + + _END_UNDO_ACTION_ } diff --git a/src/Notepad3.c b/src/Notepad3.c index cd56ec607..87d77cc3d 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -3483,7 +3483,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) CancelCallTip(); break; - case IDT_TIMER_UNDO_REDO_SPLIT: + case IDT_TIMER_UNDO_TRANSACTION: _SplitUndoTransaction((int)lParam); break; @@ -4072,45 +4072,35 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_EDIT_INDENT: { - _BEGIN_UNDO_ACTION_ EditIndentBlock(Globals.hwndEdit, SCI_TAB, true, false); - _END_UNDO_ACTION_ } break; case IDM_EDIT_UNINDENT: { - _BEGIN_UNDO_ACTION_ EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, true, false); - _END_UNDO_ACTION_ } break; case CMD_TAB: { - _BEGIN_UNDO_ACTION_ EditIndentBlock(Globals.hwndEdit, SCI_TAB, false, false); - _END_UNDO_ACTION_ } break; case CMD_BACKTAB: { - _BEGIN_UNDO_ACTION_ - EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, false, false); - _END_UNDO_ACTION_ + EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, false, false); } break; case CMD_CTRLTAB: { - _BEGIN_UNDO_ACTION_ SciCall_SetUseTabs(true); SciCall_SetTabIndents(false); EditIndentBlock(Globals.hwndEdit, SCI_TAB, false, false); SciCall_SetTabIndents(Globals.fvCurFile.bTabIndents); SciCall_SetUseTabs(!Globals.fvCurFile.bTabsAsSpaces); - _END_UNDO_ACTION_ } break; @@ -8048,17 +8038,17 @@ static void _DelayClearZoomCallTip(int delay) //============================================================================= // -// _DelayClearZoomCallTip() +// _DelaySplitUndoTransaction() // // static void _DelaySplitUndoTransaction(int delay, int iModType) { - static CmdMessageQueue_t mqc = MQ_WM_CMD_INIT(IDT_TIMER_UNDO_REDO_SPLIT, 0); - mqc.hwnd = Globals.hwndMain; + static CmdMessageQueue_t mqc = MQ_WM_CMD_INIT(IDT_TIMER_UNDO_TRANSACTION, 0); if (!((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO))) { + mqc.hwnd = Globals.hwndMain; mqc.lparam = (LPARAM)iModType; + _MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay))); } - _MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay))); } @@ -9186,7 +9176,8 @@ bool RestoreAction(int token, DoAction doAct) pPosAnchorVS = (DocPos*)((UNDO == doAct) ? utarray_front(pSel->anchorVS_undo) : utarray_front(pSel->anchorVS_redo)); pPosCurVS = (DocPos*)((UNDO == doAct) ? utarray_front(pSel->curVS_undo) : utarray_front(pSel->curVS_redo)); - if (pPosAnchor && pPosCur) { + if (pPosAnchor && pPosCur) + { // Ensure that the first and last lines of a selection are always unfolded // This needs to be done _before_ the SCI_SETSEL message DocLn const anchorPosLine = SciCall_LineFromPosition((*pPosAnchor)); @@ -9203,16 +9194,19 @@ bool RestoreAction(int token, DoAction doAct) { case NP3_SEL_MULTI: { + unsigned int i = 0; + + DocPosU const selCount = (UNDO == doAct) ? utarray_len(pSel->anchorPos_undo) : utarray_len(pSel->anchorPos_redo); + DocPosU const selCountVS = (UNDO == doAct) ? utarray_len(pSel->anchorVS_undo) : utarray_len(pSel->anchorVS_redo); + PostMessage(hwndedit, SCI_SETSELECTION, (WPARAM)(*pPosCur), (LPARAM)(*pPosAnchor)); if (pPosAnchorVS && pPosCurVS) { PostMessage(hwndedit, SCI_SETSELECTIONNANCHORVIRTUALSPACE, (WPARAM)0, (LPARAM)(*pPosAnchorVS)); PostMessage(hwndedit, SCI_SETSELECTIONNCARETVIRTUALSPACE, (WPARAM)0, (LPARAM)(*pPosCurVS)); } - - DocPosU const selCount = (UNDO == doAct) ? utarray_len(pSel->anchorPos_undo) : utarray_len(pSel->anchorPos_redo); - DocPosU const selCountVS = (UNDO == doAct) ? utarray_len(pSel->anchorVS_undo) : utarray_len(pSel->anchorVS_redo); - - unsigned int i = 1; + PostMessage(hwndedit, SCI_CANCEL, 0, 0); // (!) else shift-key selection behavior is kept + + ++i; while (i < selCount) { pPosAnchor = (DocPos*)((UNDO == doAct) ? utarray_eltptr(pSel->anchorPos_undo, i) : utarray_eltptr(pSel->anchorPos_redo, i)); @@ -9230,6 +9224,7 @@ bool RestoreAction(int token, DoAction doAct) } ++i; } + //~PostMessage(hwndedit, SCI_SETMAINSELECTION, (WPARAM)0, (LPARAM)0); } break; @@ -9393,10 +9388,8 @@ bool ConsistentIndentationCheck(EditFileIOStatus* status) SciCall_SetBackSpaceUnIndents(true); BeginWaitCursor(NULL); - _BEGIN_UNDO_ACTION_ EditIndentBlock(Globals.hwndEdit, SCI_TAB, true, true); EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, true, true); - _END_UNDO_ACTION_ EndWaitCursor(); SciCall_SetUseTabs(useTabs); diff --git a/src/VersionEx.h b/src/VersionEx.h index 4cdfb5df9..330d9ca79 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 828 -#define VERSION_BUILD 2604 +#define VERSION_BUILD 2605 #define SCINTILLA_VER 420 #define ONIGURUMA_REGEX_VER 6.9.3 #define UCHARDET_VER 2018.09.27 diff --git a/src/resource.h b/src/resource.h index c69c2c038..6b75cb6ac 100644 --- a/src/resource.h +++ b/src/resource.h @@ -31,7 +31,7 @@ #define IDT_TIMER_UPDATE_STATUSBAR 236 #define IDT_TIMER_UPDATE_TOOLBAR 237 #define IDT_TIMER_CLEAR_CALLTIP 238 -#define IDT_TIMER_UNDO_REDO_SPLIT 239 +#define IDT_TIMER_UNDO_TRANSACTION 239 #define IDACC_FIND 302 #define IDACC_REPLACE 303