mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 05:09:12 +02:00
Indent block when Persistent blocks are off
This commit is contained in:
parent
517123899a
commit
28aaa672a1
@ -5376,11 +5376,15 @@ var
|
|||||||
ey,i{,indlen} : Sw_integer;
|
ey,i{,indlen} : Sw_integer;
|
||||||
S,Ind : String;
|
S,Ind : String;
|
||||||
Pos : Tpoint;
|
Pos : Tpoint;
|
||||||
|
WasPersistentBlocks : boolean;
|
||||||
begin
|
begin
|
||||||
if IsReadOnly then Exit;
|
if IsReadOnly then Exit;
|
||||||
if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
|
if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
|
||||||
Lock;
|
Lock;
|
||||||
AddGroupedAction(eaIndentBlock);
|
AddGroupedAction(eaIndentBlock);
|
||||||
|
WasPersistentBlocks:=IsFlagSet(efPersistentBlocks);
|
||||||
|
if not WasPersistentBlocks then
|
||||||
|
SetFlags(GetFlags or efPersistentBlocks);
|
||||||
ey:=selend.y;
|
ey:=selend.y;
|
||||||
if selend.x=0 then
|
if selend.x=0 then
|
||||||
dec(ey);
|
dec(ey);
|
||||||
@ -5425,6 +5429,9 @@ begin
|
|||||||
AddAction(eaInsertText,Pos,Pos,Ind,GetFlags);
|
AddAction(eaInsertText,Pos,Pos,Ind,GetFlags);
|
||||||
end;
|
end;
|
||||||
SetCurPtr(CurPos.X,CurPos.Y);
|
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 }
|
{ must be added manually here PM }
|
||||||
AddAction(eaMoveCursor,Pos,CurPos,'',GetFlags);
|
AddAction(eaMoveCursor,Pos,CurPos,'',GetFlags);
|
||||||
UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll);
|
UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll);
|
||||||
@ -5439,11 +5446,15 @@ var
|
|||||||
ey,i,j,k,indlen : Sw_integer;
|
ey,i,j,k,indlen : Sw_integer;
|
||||||
S : String;
|
S : String;
|
||||||
Pos : TPoint;
|
Pos : TPoint;
|
||||||
|
WasPersistentBlocks : boolean;
|
||||||
begin
|
begin
|
||||||
if IsReadOnly then Exit;
|
if IsReadOnly then Exit;
|
||||||
if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
|
if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
|
||||||
Lock;
|
Lock;
|
||||||
AddGroupedAction(eaUnindentBlock);
|
AddGroupedAction(eaUnindentBlock);
|
||||||
|
WasPersistentBlocks:=IsFlagSet(efPersistentBlocks);
|
||||||
|
if not WasPersistentBlocks then
|
||||||
|
SetFlags(GetFlags or efPersistentBlocks);
|
||||||
ey:=selend.y;
|
ey:=selend.y;
|
||||||
if selend.x=0 then
|
if selend.x=0 then
|
||||||
dec(ey);
|
dec(ey);
|
||||||
@ -5501,6 +5512,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SetCurPtr(CurPos.X,CurPos.Y);
|
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);
|
UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll);
|
||||||
DrawLines(CurPos.Y);
|
DrawLines(CurPos.Y);
|
||||||
SetModified(true);
|
SetModified(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user