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:
Pairi Daiza 2022-08-30 19:25:03 +02:00 committed by GitHub
commit f38c3be9eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View File

@ -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();
}

View File

@ -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);

View File

@ -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_); } }