From 28aaa672a1462d915f7212273805bc1eb0bad471 Mon Sep 17 00:00:00 2001 From: Margers Date: Sun, 1 Sep 2024 20:47:08 +0000 Subject: [PATCH] Indent block when Persistent blocks are off --- packages/ide/weditor.pas | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/ide/weditor.pas b/packages/ide/weditor.pas index b3f5d9ec8d..ae9e538c5b 100644 --- a/packages/ide/weditor.pas +++ b/packages/ide/weditor.pas @@ -5376,11 +5376,15 @@ var ey,i{,indlen} : Sw_integer; S,Ind : String; Pos : Tpoint; + WasPersistentBlocks : boolean; begin if IsReadOnly then Exit; if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit; Lock; AddGroupedAction(eaIndentBlock); + WasPersistentBlocks:=IsFlagSet(efPersistentBlocks); + if not WasPersistentBlocks then + SetFlags(GetFlags or efPersistentBlocks); ey:=selend.y; if selend.x=0 then dec(ey); @@ -5425,6 +5429,9 @@ begin AddAction(eaInsertText,Pos,Pos,Ind,GetFlags); end; SetCurPtr(CurPos.X,CurPos.Y); + {after SetCurPtr return PersistentBlocks as it was before} + if not WasPersistentBlocks then + SetFlags(GetFlags and (not longword(efPersistentBlocks))); { must be added manually here PM } AddAction(eaMoveCursor,Pos,CurPos,'',GetFlags); UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll); @@ -5439,11 +5446,15 @@ var ey,i,j,k,indlen : Sw_integer; S : String; Pos : TPoint; + WasPersistentBlocks : boolean; begin if IsReadOnly then Exit; if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit; Lock; AddGroupedAction(eaUnindentBlock); + WasPersistentBlocks:=IsFlagSet(efPersistentBlocks); + if not WasPersistentBlocks then + SetFlags(GetFlags or efPersistentBlocks); ey:=selend.y; if selend.x=0 then dec(ey); @@ -5501,6 +5512,9 @@ begin end; end; SetCurPtr(CurPos.X,CurPos.Y); + {after SetCurPtr return PersistentBlocks as it was before} + if not WasPersistentBlocks then + SetFlags(GetFlags and (not longword(efPersistentBlocks))); UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll); DrawLines(CurPos.Y); SetModified(true);