small fixes

This commit is contained in:
Martin 2023-07-25 01:52:59 +02:00
parent 4bf617c018
commit a94c7262d6
6 changed files with 28 additions and 28 deletions

View File

@ -141,7 +141,7 @@ type
cfbtWhileDo, cfbtWhileDo,
cfbtWithDo, cfbtWithDo,
cfbtIfElse, cfbtIfElse,
cfbtAnonynmousProcedure, cfbtAnonymousProcedure,
// Internal type / not configurable // Internal type / not configurable
cfbtCaseElse, // "else" in case can have multiply statements cfbtCaseElse, // "else" in case can have multiply statements
cfbtPackage, cfbtPackage,
@ -152,7 +152,7 @@ type
const const
cfbtLastPublic = cfbtAnonynmousProcedure; cfbtLastPublic = cfbtAnonymousProcedure;
cfbtFirstPrivate = cfbtCaseElse; cfbtFirstPrivate = cfbtCaseElse;
CountPascalCodeFoldBlockOffset = CountPascalCodeFoldBlockOffset =
@ -162,7 +162,7 @@ const
[low(TPascalCodeFoldBlockType)..high(TPascalCodeFoldBlockType)]); [low(TPascalCodeFoldBlockType)..high(TPascalCodeFoldBlockType)]);
PascalWordTripletRanges = TPascalCodeFoldBlockTypes( PascalWordTripletRanges = TPascalCodeFoldBlockTypes(
[cfbtBeginEnd, cfbtTopBeginEnd, cfbtProcedure, cfbtAnonynmousProcedure, cfbtClass, cfbtProgram, cfbtRecord, [cfbtBeginEnd, cfbtTopBeginEnd, cfbtProcedure, cfbtAnonymousProcedure, cfbtClass, cfbtProgram, cfbtRecord,
cfbtTry, cfbtExcept, cfbtRepeat, cfbtAsm, cfbtCase, cfbtCaseElse, cfbtTry, cfbtExcept, cfbtRepeat, cfbtAsm, cfbtCase, cfbtCaseElse,
cfbtIfDef, cfbtRegion, cfbtIfDef, cfbtRegion,
cfbtIfThen, cfbtForDo,cfbtWhileDo,cfbtWithDo cfbtIfThen, cfbtForDo,cfbtWhileDo,cfbtWithDo
@ -545,7 +545,7 @@ type
function ScanAheadForNextToken(RunOffs: Integer; function ScanAheadForNextToken(RunOffs: Integer;
out AFndLine: String; out ATokStart, ATokLen: integer; out AFndLine: String; out ATokStart, ATokLen: integer;
MaxLineCnt: Integer = 1000): Boolean; //inline; MaxLineCnt: Integer = 1000): Boolean; //inline;
function IsAnonynmousFunc(RunOffs: Integer; AnIsFunction: boolean): Boolean; function IsAnonymousFunc(RunOffs: Integer; AnIsFunction: boolean): Boolean;
function StartPascalCodeFoldBlock function StartPascalCodeFoldBlock
(ABlockType: TPascalCodeFoldBlockType; ForceDisabled: Boolean = False (ABlockType: TPascalCodeFoldBlockType; ForceDisabled: Boolean = False
@ -1144,7 +1144,7 @@ begin
EndPascalCodeFoldBlock; EndPascalCodeFoldBlock;
end else if tfb in [cfbtTopBeginEnd, cfbtAsm] then begin end else if tfb in [cfbtTopBeginEnd, cfbtAsm] then begin
EndPascalCodeFoldBlock; EndPascalCodeFoldBlock;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonynmousProcedure] then if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure] then
EndPascalCodeFoldBlock; EndPascalCodeFoldBlock;
end else if tfb in [cfbtCaseElse] then begin end else if tfb in [cfbtCaseElse] then begin
EndPascalCodeFoldBlock; EndPascalCodeFoldBlock;
@ -1162,7 +1162,7 @@ begin
EndPascalCodeFoldBlock(True); EndPascalCodeFoldBlock(True);
end; end;
fStringLen := sl; fStringLen := sl;
end else if tfb = cfbtProcedure then begin //cfbtAnonynmousProcedure ? end else if tfb = cfbtProcedure then begin //cfbtAnonymousProcedure ?
// EndPascalCodeFoldBlock; // wrong source: procedure end, without begin // EndPascalCodeFoldBlock; // wrong source: procedure end, without begin
end else if tfb = cfbtUnitSection then begin end else if tfb = cfbtUnitSection then begin
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
@ -1254,11 +1254,11 @@ function TSynPasSyn.Func32: TtkTokenKind;
begin begin
if KeyComp('Label') then begin if KeyComp('Label') then begin
if (TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType, cfbtNone, if (TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType, cfbtNone,
cfbtProcedure, cfbtAnonynmousProcedure, cfbtProgram, cfbtUnit, cfbtUnitSection]) cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram, cfbtUnit, cfbtUnitSection])
then begin then begin
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonynmousProcedure] if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType) then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType); else StartPascalCodeFoldBlock(cfbtVarType);
end; end;
@ -1347,7 +1347,7 @@ begin
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
Result := tkKey; Result := tkKey;
tbf := TopPascalCodeFoldBlockType; tbf := TopPascalCodeFoldBlockType;
if tbf in [cfbtProcedure, cfbtAnonynmousProcedure] if tbf in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtTopBeginEnd, True) then StartPascalCodeFoldBlock(cfbtTopBeginEnd, True)
else StartPascalCodeFoldBlock(cfbtBeginEnd, tbf in [ else StartPascalCodeFoldBlock(cfbtBeginEnd, tbf in [
cfbtProgram, cfbtUnit, cfbtUnitSection, cfbtPackage, cfbtProgram, cfbtUnit, cfbtUnitSection, cfbtPackage,
@ -1429,11 +1429,11 @@ begin
else if KeyComp('Var') then begin else if KeyComp('Var') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) and
(TopPascalCodeFoldBlockType in (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonynmousProcedure, cfbtProgram, [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram,
cfbtUnit, cfbtUnitSection]) then begin cfbtUnit, cfbtUnitSection]) then begin
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonynmousProcedure] if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType) then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType); else StartPascalCodeFoldBlock(cfbtVarType);
end; end;
@ -1748,7 +1748,7 @@ begin
if KeyComp('Type') then begin if KeyComp('Type') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) if (PasCodeFoldRange.BracketNestLevel = 0)
and (TopPascalCodeFoldBlockType in and (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonynmousProcedure, cfbtProgram, [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram,
cfbtUnit, cfbtUnitSection]) cfbtUnit, cfbtUnitSection])
then begin then begin
if (rsAfterEqualOrColon in fRange) then begin if (rsAfterEqualOrColon in fRange) then begin
@ -1758,7 +1758,7 @@ begin
else begin else begin
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonynmousProcedure] if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType) then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType); else StartPascalCodeFoldBlock(cfbtVarType);
fRange := fRange + [rsInTypeBlock]; fRange := fRange + [rsInTypeBlock];
@ -1819,11 +1819,11 @@ begin
else if KeyComp('Const') then begin else if KeyComp('Const') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) and
(TopPascalCodeFoldBlockType in (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonynmousProcedure, cfbtProgram, [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram,
cfbtUnit, cfbtUnitSection]) then begin cfbtUnit, cfbtUnitSection]) then begin
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonynmousProcedure] if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType) then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType); else StartPascalCodeFoldBlock(cfbtVarType);
end; end;
@ -2280,8 +2280,8 @@ var
InClass: Boolean; InClass: Boolean;
begin begin
if KeyComp('Function') then begin if KeyComp('Function') then begin
if (TopPascalCodeFoldBlockType in PascalStatementBlocks) and IsAnonynmousFunc(8, True) then begin if (TopPascalCodeFoldBlockType in PascalStatementBlocks) and IsAnonymousFunc(8, True) then begin
StartPascalCodeFoldBlock(cfbtAnonynmousProcedure); StartPascalCodeFoldBlock(cfbtAnonymousProcedure);
end end
else begin else begin
if not(rsAfterEqualOrColon in fRange) then begin if not(rsAfterEqualOrColon in fRange) then begin
@ -2334,8 +2334,8 @@ var
InClass: Boolean; InClass: Boolean;
begin begin
if KeyComp('Procedure') then begin if KeyComp('Procedure') then begin
if (TopPascalCodeFoldBlockType in PascalStatementBlocks) and IsAnonynmousFunc(9, False) then begin if (TopPascalCodeFoldBlockType in PascalStatementBlocks) and IsAnonymousFunc(9, False) then begin
StartPascalCodeFoldBlock(cfbtAnonynmousProcedure); StartPascalCodeFoldBlock(cfbtAnonymousProcedure);
end end
else begin else begin
if not(rsAfterEqualOrColon in fRange) then begin if not(rsAfterEqualOrColon in fRange) then begin
@ -3497,7 +3497,7 @@ begin
t := TopPascalCodeFoldBlockType; t := TopPascalCodeFoldBlockType;
if ( (t in PascalStatementBlocks - [cfbtAsm]) or //cfbtClass, cfbtClassSection, if ( (t in PascalStatementBlocks - [cfbtAsm]) or //cfbtClass, cfbtClassSection,
( ( (t in [cfbtVarType, cfbtLocalVarType]) or ( ( (t in [cfbtVarType, cfbtLocalVarType]) or
((t in [cfbtProcedure, cfbtAnonynmousProcedure]) and (PasCodeFoldRange.BracketNestLevel > 0)) ((t in [cfbtProcedure, cfbtAnonymousProcedure]) and (PasCodeFoldRange.BracketNestLevel > 0))
) and ) and
(fRange * [rsInTypeBlock, rsAfterEqual] = [rsAfterEqual]) (fRange * [rsInTypeBlock, rsAfterEqual] = [rsAfterEqual])
)) and )) and
@ -4493,7 +4493,7 @@ begin
end; end;
end; end;
function TSynPasSyn.IsAnonynmousFunc(RunOffs: Integer; AnIsFunction: boolean function TSynPasSyn.IsAnonymousFunc(RunOffs: Integer; AnIsFunction: boolean
): Boolean; ): Boolean;
var var
FndLine: String; FndLine: String;
@ -4658,13 +4658,13 @@ begin
Include( aActions, sfaOutlineMergeParent); Include( aActions, sfaOutlineMergeParent);
end; end;
if (PasBlockType in [cfbtProcedure, cfbtAnonynmousProcedure]) then begin if (PasBlockType in [cfbtProcedure, cfbtAnonymousProcedure]) then begin
t := FFoldConfig[ord(cfbtTopBeginEnd)]; t := FFoldConfig[ord(cfbtTopBeginEnd)];
if t.Enabled and (sfaOutline in t.FoldActions) then if t.Enabled and (sfaOutline in t.FoldActions) then
aActions := aActions + [sfaOutlineKeepLevel,sfaOutlineNoColor]; aActions := aActions + [sfaOutlineKeepLevel,sfaOutlineNoColor];
end; end;
//if (PasBlockType in [cfbtProcedure, cfbtAnonynmousProcedure]) and (InProcLevel > 0) then //nested //if (PasBlockType in [cfbtProcedure, cfbtAnonymousProcedure]) and (InProcLevel > 0) then //nested
// aActions := aActions + [sfaOutlineForceIndent]; // aActions := aActions + [sfaOutlineForceIndent];
if (PasBlockType in [cfbtExcept]) then begin if (PasBlockType in [cfbtExcept]) then begin
@ -4909,7 +4909,7 @@ begin
exit; exit;
while TopPascalCodeFoldBlockType in PascalStatementBlocks + [cfbtAsm] do while TopPascalCodeFoldBlockType in PascalStatementBlocks + [cfbtAsm] do
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonynmousProcedure] then if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure] then
EndPascalCodeFoldBlockLastLine; // This procedure did have a begin/end block, so it must end too EndPascalCodeFoldBlockLastLine; // This procedure did have a begin/end block, so it must end too
end; end;

View File

@ -1451,7 +1451,7 @@ begin
if (i and $08) = 0 then AFolds := AFolds - [cfbtClass, cfbtRecord]; if (i and $08) = 0 then AFolds := AFolds - [cfbtClass, cfbtRecord];
if (i and $10) = 0 then AFolds := AFolds - [cfbtClassSection]; if (i and $10) = 0 then AFolds := AFolds - [cfbtClassSection];
if (i and $20) = 0 then AFolds := AFolds - [cfbtProcedure]; if (i and $20) = 0 then AFolds := AFolds - [cfbtProcedure];
//if (i and $40) = 0 then AFolds := AFolds - [cfbtAnonynmousProcedure]; //if (i and $40) = 0 then AFolds := AFolds - [cfbtAnonymousProcedure];
SubTest('deprecated' , AFolds); SubTest('deprecated' , AFolds);
SubTest('unimplemented', AFolds); SubTest('unimplemented', AFolds);
SubTest('experimental' , AFolds); SubTest('experimental' , AFolds);

View File

@ -519,7 +519,7 @@ const
(Name: dlgFoldPasProcedure; Xml: 'Procedure'; (Name: dlgFoldPasProcedure; Xml: 'Procedure';
Index: ord(cfbtProcedure); Enabled: True), Index: ord(cfbtProcedure); Enabled: True),
(Name: dlgFoldPasAnonProcedure; Xml: 'AnonymousProcedure'; (Name: dlgFoldPasAnonProcedure; Xml: 'AnonymousProcedure';
Index: ord(cfbtAnonynmousProcedure); Enabled: True), Index: ord(cfbtAnonymousProcedure); Enabled: True),
(Name: dlgFoldLocalPasVarType; Xml: 'LocalVarType'; (Name: dlgFoldLocalPasVarType; Xml: 'LocalVarType';
Index: ord(cfbtLocalVarType); Enabled: True), Index: ord(cfbtLocalVarType); Enabled: True),
(Name: dlgFoldPasProcBeginEnd; Xml: 'ProcBeginEnd'; (Name: dlgFoldPasProcBeginEnd; Xml: 'ProcBeginEnd';

View File

@ -1,4 +1,4 @@
unit BreakprointGroupFrame; unit BreakpointGroupFrame;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}

View File

@ -42,7 +42,7 @@ uses
Menus, ComCtrls, Debugger, DebuggerDlg, ActnList, ExtCtrls, IDEImagesIntf, Menus, ComCtrls, Debugger, DebuggerDlg, ActnList, ExtCtrls, IDEImagesIntf,
{$ifdef Windows} ActiveX, {$else} laz.FakeActiveX, {$endif} {$ifdef Windows} ActiveX, {$else} laz.FakeActiveX, {$endif}
DbgIntfDebuggerBase, DbgIntfMiscClasses, BaseDebugManager, DbgIntfDebuggerBase, DbgIntfMiscClasses, BaseDebugManager,
IdeDebuggerStringConstants, DebuggerTreeView, BreakprointGroupFrame, IdeDebuggerStringConstants, DebuggerTreeView, breakpointgroupframe,
IdeDebuggerOpts, IdeIntfStrConsts, SrcEditorIntf, laz.VirtualTrees; IdeDebuggerOpts, IdeIntfStrConsts, SrcEditorIntf, laz.VirtualTrees;
type type