mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #4145 from RaiKoHoff/Dev_Master
Fix TAB (indent) usage in case of read-only mode sets doc modified flag
This commit is contained in:
commit
f38c3be9eb
@ -3298,7 +3298,7 @@ void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation, bool bForceAll
|
||||
return;
|
||||
}
|
||||
|
||||
//~~~UndoTransActionBegin(); ~ do outside
|
||||
DocChangeTransactionBegin()
|
||||
|
||||
if (bForceAll) {
|
||||
SciCall_SelectAll();
|
||||
@ -3369,7 +3369,7 @@ void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation, bool bForceAll
|
||||
Sci_ScrollChooseCaret();
|
||||
}
|
||||
|
||||
//~~~EndUndoTransAction(); ~ do outside
|
||||
EndDocChangeTransaction();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5023,35 +5023,25 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
|
||||
case IDM_EDIT_INDENT:
|
||||
UndoTransActionBegin();
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_TAB, true, false);
|
||||
EndUndoTransAction();
|
||||
break;
|
||||
|
||||
case IDM_EDIT_UNINDENT:
|
||||
UndoTransActionBegin();
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, true, false);
|
||||
EndUndoTransAction();
|
||||
break;
|
||||
|
||||
case CMD_TAB:
|
||||
UndoTransActionBegin();
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_TAB, false, false);
|
||||
EndUndoTransAction();
|
||||
break;
|
||||
|
||||
case CMD_BACKTAB:
|
||||
UndoTransActionBegin();
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, false, false);
|
||||
EndUndoTransAction();
|
||||
break;
|
||||
|
||||
case CMD_CTRLTAB:
|
||||
SciCall_SetUseTabs(true);
|
||||
SciCall_SetTabIndents(false);
|
||||
UndoTransActionBegin();
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_TAB, false, false);
|
||||
EndUndoTransAction();
|
||||
SciCall_SetTabIndents(Globals.fvCurFile.bTabIndents);
|
||||
SciCall_SetUseTabs(!Globals.fvCurFile.bTabsAsSpaces);
|
||||
break;
|
||||
@ -10552,10 +10542,8 @@ bool ConsistentIndentationCheck(EditFileIOStatus* status)
|
||||
bool const backSpcUnindents = SciCall_GetBackSpaceUnIndents();
|
||||
SciCall_SetBackSpaceUnIndents(true);
|
||||
|
||||
UndoTransActionBegin();
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_TAB, true, true);
|
||||
EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, true, true);
|
||||
EndUndoTransAction();
|
||||
|
||||
SciCall_SetUseTabs(useTabs);
|
||||
SciCall_SetTabIndents(tabIndents);
|
||||
|
||||
@ -202,13 +202,13 @@ void ObserveNotifyDocChangedEvent();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// lean msg change notify
|
||||
// lean msg change notify (preferred)
|
||||
#define DocChangeTransactionBegin() __try { IgnoreNotifyDocChangedEvent(EVM_Default); SciCall_BeginUndoAction();
|
||||
#define EndDocChangeTransaction() } __finally { SciCall_EndUndoAction(); ObserveNotifyDocChangedEvent(); }
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// none msg change notify
|
||||
// none msg change notify (only in simple, non complex operations)
|
||||
#define UndoTransActionBegin() { int const _token_ = BeginUndoAction(); __try { IgnoreNotifyDocChangedEvent(EVM_None);
|
||||
#define EndUndoTransAction() } __finally { ObserveNotifyDocChangedEvent(); EndUndoAction(_token_); } }
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user