mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 08:19:56 +02:00
synedit: fixed codefolding subblocks when case without begin
git-svn-id: trunk@9665 -
This commit is contained in:
parent
5643a1ba44
commit
51bd7772b9
@ -1203,7 +1203,7 @@ end;
|
|||||||
function TSynCustomHighlighter.StartCodeFoldBlock(ABlockType: Pointer;
|
function TSynCustomHighlighter.StartCodeFoldBlock(ABlockType: Pointer;
|
||||||
SubBlock: boolean): TSynCustomCodeFoldBlock;
|
SubBlock: boolean): TSynCustomCodeFoldBlock;
|
||||||
begin
|
begin
|
||||||
if SubBlock then begin
|
if SubBlock and (CodeFoldRange.Top<>nil) then begin
|
||||||
Result:=CodeFoldRange.Top;
|
Result:=CodeFoldRange.Top;
|
||||||
if (Result.BlockType=ABlockType) then
|
if (Result.BlockType=ABlockType) then
|
||||||
Result.Level:=Result.Level+1
|
Result.Level:=Result.Level+1
|
||||||
@ -1218,7 +1218,7 @@ var
|
|||||||
TopBlock: TSynCustomCodeFoldBlock;
|
TopBlock: TSynCustomCodeFoldBlock;
|
||||||
begin
|
begin
|
||||||
TopBlock:=CodeFoldRange.Top;
|
TopBlock:=CodeFoldRange.Top;
|
||||||
if TopBlock.Level>0 then
|
if (TopBlock<>nil) and (TopBlock.Level>0) then
|
||||||
TopBlock.Level:=TopBlock.Level-1
|
TopBlock.Level:=TopBlock.Level-1
|
||||||
else begin
|
else begin
|
||||||
CodeFoldRange.Pop;
|
CodeFoldRange.Pop;
|
||||||
|
@ -663,7 +663,8 @@ begin
|
|||||||
end else
|
end else
|
||||||
if KeyComp('Case') then begin
|
if KeyComp('Case') then begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
|
if TopPascalCodeFoldBlockType=cfbtBeginEnd then
|
||||||
|
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result := tkKey;
|
Result := tkKey;
|
||||||
end else Result := tkIdentifier;
|
end else Result := tkIdentifier;
|
||||||
@ -819,7 +820,8 @@ begin
|
|||||||
if KeyComp('Try') then
|
if KeyComp('Try') then
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
begin
|
begin
|
||||||
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
|
if TopPascalCodeFoldBlockType=cfbtBeginEnd then
|
||||||
|
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
|
||||||
Result := tkKey;
|
Result := tkKey;
|
||||||
end else
|
end else
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
|
@ -1125,7 +1125,7 @@ var
|
|||||||
function ControlIsVisible(AControl: TControl): boolean;
|
function ControlIsVisible(AControl: TControl): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(AControl<>nil)
|
Result:=(AControl<>nil)
|
||||||
and ((AControl.Visible) or (AControl=VisibleControl));
|
and ((AControl.IsVisible) or (AControl=VisibleControl));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindNode(const AName: string): TLazDockConfigNode;
|
function FindNode(const AName: string): TLazDockConfigNode;
|
||||||
@ -1296,6 +1296,32 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function AllControlsAreOnSameForm: boolean;
|
||||||
|
|
||||||
|
function Check(Node: TLazDockConfigNode): boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Docker: TCustomLazControlDocker;
|
||||||
|
CurForm: TControl;
|
||||||
|
begin
|
||||||
|
if Node.TheType=ldcntControl then begin
|
||||||
|
Docker:=FindDockerByName(Node.Name);
|
||||||
|
if (Docker<>nil) and (Docker.Control<>nil) then begin
|
||||||
|
//if Docker.Control
|
||||||
|
CurForm:=Docker.Control;
|
||||||
|
while CurForm.Parent<>nil do
|
||||||
|
CurForm:=CurForm.Parent;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
// check childs
|
||||||
|
for i:=0 to Node.ChildCount-1 do
|
||||||
|
if not Check(Node.Childs[i]) then exit(false);
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=Check(Root);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
Config: TLazDockerConfig;
|
Config: TLazDockerConfig;
|
||||||
@ -1316,6 +1342,10 @@ begin
|
|||||||
RemoveEmptyNodes(Root);
|
RemoveEmptyNodes(Root);
|
||||||
|
|
||||||
// check if all used controls are on the same dock form
|
// check if all used controls are on the same dock form
|
||||||
|
if not AllControlsAreOnSameForm then begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
// Now Root contains a Layout for the case that all visible controls are put
|
// Now Root contains a Layout for the case that all visible controls are put
|
||||||
// into one dock form.
|
// into one dock form.
|
||||||
|
Loading…
Reference in New Issue
Block a user