From 4ee2d3876f9befd5ca00db344ab6584239d59dc7 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 27 Aug 2019 13:55:05 +0200 Subject: [PATCH] + chg: allow each modification step to split undo typing sequence (set timeout < 20ms) --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Config/Config.cpp | 6 ++---- src/Notepad3.c | 15 ++++++++++++--- src/VersionEx.h | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 45c4a6b22..bf88273b1 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2599 +2600 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index dbb9431b9..deb4791b1 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index 8c06018c3..2fb0292d5 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -631,10 +631,8 @@ void LoadSettings() FileWatching.AutoReloadTimeout = Settings2.AutoReloadTimeout; Defaults2.UndoRedoSplitTimeout = 0UL; - Settings2.UndoRedoSplitTimeout = IniSectionGetInt(Settings2_Section, L"UndoRedoSplitTimeout", Defaults2.UndoRedoSplitTimeout); - if (Settings2.UndoRedoSplitTimeout != 0) { - Settings2.UndoRedoSplitTimeout = clampul(Settings2.UndoRedoSplitTimeout, 100UL, 86400000UL); // max: 24h - } + Settings2.UndoRedoSplitTimeout = clampul(IniSectionGetInt(Settings2_Section, L"UndoRedoSplitTimeout", + Defaults2.UndoRedoSplitTimeout), 0UL, 86400000UL); // deprecated Defaults.RenderingTechnology = IniSectionGetInt(Settings2_Section, L"SciDirectWriteTech", -111); diff --git a/src/Notepad3.c b/src/Notepad3.c index e049ac8b9..aecd38837 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -459,6 +459,7 @@ static int msgcmp(void* mqc1, void* mqc2) } // ---------------------------------------------------------------------------- +#define _MQ_IMMEDIATE (2 * USER_TIMER_MINIMUM - 1) #define _MQ_ms(T) ((T) / USER_TIMER_MINIMUM) static void _MQ_AppendCmd(CmdMessageQueue_t* const pMsgQCmd, int cycles) @@ -6976,7 +6977,7 @@ inline static LRESULT _MsgNotifyLean(const LPNMHDR pnmh, const SCNotification* c _SaveRedoSelection(_SaveUndoSelection()); } } - if (Settings2.UndoRedoSplitTimeout != 0) { + if (Settings2.UndoRedoSplitTimeout > _MQ_IMMEDIATE) { _DelayUndoRedoTypingSequenceSplit(Settings2.UndoRedoSplitTimeout); } bModified = false; // not yet @@ -6991,7 +6992,12 @@ inline static LRESULT _MsgNotifyLean(const LPNMHDR pnmh, const SCNotification* c RestoreAction(scn->token, REDO); } } - if (bModified) { _SetSaveNeededFlag(true); } + if (bModified) { + if ((Settings2.UndoRedoSplitTimeout > 0UL) && (Settings2.UndoRedoSplitTimeout <= _MQ_IMMEDIATE)) { + SciCall_BeginUndoAction(); SciCall_EndUndoAction(); + } + _SetSaveNeededFlag(true); + } } else if (pnmh->code == SCN_SAVEPOINTREACHED) { _SetSaveNeededFlag(false); @@ -7063,7 +7069,7 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific _SaveRedoSelection(_SaveUndoSelection()); } } - if (Settings2.UndoRedoSplitTimeout != 0) { + if (Settings2.UndoRedoSplitTimeout > _MQ_IMMEDIATE) { _DelayUndoRedoTypingSequenceSplit(Settings2.UndoRedoSplitTimeout); } bModified = false; // not yet @@ -7085,6 +7091,9 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific if (scn->linesAdded != 0) { UpdateMarginWidth(); } + if ((Settings2.UndoRedoSplitTimeout > 0UL) && (Settings2.UndoRedoSplitTimeout <= _MQ_IMMEDIATE)) { + SciCall_BeginUndoAction(); SciCall_EndUndoAction(); + } _SetSaveNeededFlag(true); } diff --git a/src/VersionEx.h b/src/VersionEx.h index ce0de48aa..b27991c24 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 827 -#define VERSION_BUILD 2599 +#define VERSION_BUILD 2600 #define SCINTILLA_VER 420 #define ONIGURUMA_REGEX_VER 6.9.3 #define UCHARDET_VER 2018.09.27