mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-17 21:03:19 +08:00
Merge pull request #1560 from RaiKoHoff/DevNewFeatures
Fix: timeout undo transaction on selection
This commit is contained in:
commit
d71d9be390
@ -1 +1 @@
|
||||
2599
|
||||
2601
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.827.2599"
|
||||
version="5.19.827.2601"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 BETA</description>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -386,6 +386,7 @@ static bool _InUndoRedoTransaction();
|
||||
static void _SaveRedoSelection(int token);
|
||||
static int _SaveUndoSelection();
|
||||
static int _UndoRedoActionMap(int token, UndoRedoSelection_t** selection);
|
||||
static void _SplitUndoTransaction();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -459,6 +460,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)
|
||||
@ -3482,8 +3484,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDT_TIMER_UNDO_REDO_SPLIT:
|
||||
SciCall_BeginUndoAction();
|
||||
SciCall_EndUndoAction();
|
||||
_SplitUndoTransaction();
|
||||
break;
|
||||
|
||||
|
||||
@ -6976,9 +6977,6 @@ inline static LRESULT _MsgNotifyLean(const LPNMHDR pnmh, const SCNotification* c
|
||||
_SaveRedoSelection(_SaveUndoSelection());
|
||||
}
|
||||
}
|
||||
if (Settings2.UndoRedoSplitTimeout != 0) {
|
||||
_DelayUndoRedoTypingSequenceSplit(Settings2.UndoRedoSplitTimeout);
|
||||
}
|
||||
bModified = false; // not yet
|
||||
}
|
||||
// check for ADDUNDOACTION step
|
||||
@ -6991,7 +6989,20 @@ inline static LRESULT _MsgNotifyLean(const LPNMHDR pnmh, const SCNotification* c
|
||||
RestoreAction(scn->token, REDO);
|
||||
}
|
||||
}
|
||||
if (bModified) { _SetSaveNeededFlag(true); }
|
||||
if (bModified) {
|
||||
DWORD const timeout = Settings2.UndoRedoSplitTimeout;
|
||||
if (timeout != 0UL) {
|
||||
if (timeout > _MQ_IMMEDIATE) {
|
||||
_DelayUndoRedoTypingSequenceSplit(timeout);
|
||||
}
|
||||
else {
|
||||
if (!((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO))) {
|
||||
_SplitUndoTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
_SetSaveNeededFlag(true);
|
||||
}
|
||||
}
|
||||
else if (pnmh->code == SCN_SAVEPOINTREACHED) {
|
||||
_SetSaveNeededFlag(false);
|
||||
@ -7063,9 +7074,6 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
_SaveRedoSelection(_SaveUndoSelection());
|
||||
}
|
||||
}
|
||||
if (Settings2.UndoRedoSplitTimeout != 0) {
|
||||
_DelayUndoRedoTypingSequenceSplit(Settings2.UndoRedoSplitTimeout);
|
||||
}
|
||||
bModified = false; // not yet
|
||||
}
|
||||
if (iModType & SC_MOD_CONTAINER) {
|
||||
@ -7083,8 +7091,22 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
UpdateVisibleHotspotIndicators();
|
||||
|
||||
if (scn->linesAdded != 0) {
|
||||
if (Settings.SplitUndoTypingSeqOnLnBreak) {
|
||||
_SplitUndoTransaction();
|
||||
}
|
||||
UpdateMarginWidth();
|
||||
}
|
||||
DWORD const timeout = Settings2.UndoRedoSplitTimeout;
|
||||
if (timeout != 0UL) {
|
||||
if (timeout > _MQ_IMMEDIATE) {
|
||||
_DelayUndoRedoTypingSequenceSplit(timeout);
|
||||
}
|
||||
else {
|
||||
if (!((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO))) {
|
||||
_SplitUndoTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
_SetSaveNeededFlag(true);
|
||||
}
|
||||
|
||||
@ -7212,7 +7234,6 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
switch (ich) {
|
||||
case '\r':
|
||||
case '\n':
|
||||
if (Settings.SplitUndoTypingSeqOnLnBreak) { SciCall_BeginUndoAction(); SciCall_EndUndoAction(); }
|
||||
if (Settings.AutoIndent) { _HandleAutoIndent(ich); }
|
||||
break;
|
||||
case '>':
|
||||
@ -9286,6 +9307,19 @@ static int _UndoRedoActionMap(int token, UndoRedoSelection_t** selection)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// _SplitUndoTransaction()
|
||||
//
|
||||
//
|
||||
static void _SplitUndoTransaction() {
|
||||
if (!_InUndoRedoTransaction()) {
|
||||
SciCall_BeginUndoAction();
|
||||
SciCall_EndUndoAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// FileIO()
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 827
|
||||
#define VERSION_BUILD 2599
|
||||
#define VERSION_BUILD 2601
|
||||
#define SCINTILLA_VER 420
|
||||
#define ONIGURUMA_REGEX_VER 6.9.3
|
||||
#define UCHARDET_VER 2018.09.27
|
||||
|
||||
Loading…
Reference in New Issue
Block a user