IDE, SourceEditor: fixed crash in code completion measure item, after 86db8d9f83

This commit is contained in:
Martin 2024-10-22 00:29:32 +02:00
parent 57d4df0996
commit 18b52eff3e

View File

@ -385,6 +385,7 @@ begin
// first write the type // first write the type
// var, procedure, property, function, type, const // var, procedure, property, function, type, const
AColor := clNone;
case IdentItem.GetDesc of case IdentItem.GetDesc of
ctnVarDefinition, ctnRecordCase: ctnVarDefinition, ctnRecordCase:
@ -392,7 +393,8 @@ begin
if UseImages then if UseImages then
ImageIndexCC := IDEImages.LoadImage('cc_variable') ImageIndexCC := IDEImages.LoadImage('cc_variable')
else begin else begin
AColor:=Colors.Color[ahaIdentComplWindowEntryVar].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryVar].Foreground;
s:='var'; s:='var';
end; end;
end; end;
@ -420,14 +422,16 @@ begin
end end
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryType].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryType].Foreground;
s:='type'; s:='type';
end; end;
end; end;
ctnConstDefinition,ctnConstant: ctnConstDefinition,ctnConstant:
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryConst].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryConst].Foreground;
s:='const'; s:='const';
if UseImages then if UseImages then
ImageIndexCC := IDEImages.LoadImage('cc_constant'); ImageIndexCC := IDEImages.LoadImage('cc_constant');
@ -450,12 +454,14 @@ begin
begin begin
if IdentItem.IsFunction then if IdentItem.IsFunction then
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryFunc].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryFunc].Foreground;
s:='function'; s:='function';
end end
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryProc].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryProc].Foreground;
if IdentItem.IsConstructor then if IdentItem.IsConstructor then
s := 'constructor' s := 'constructor'
else if IdentItem.IsDestructor then else if IdentItem.IsDestructor then
@ -463,10 +469,12 @@ begin
else else
s:='procedure'; s:='procedure';
end; end;
if IdentItem.TryIsAbstractMethod then if Colors <> nil then begin
AColor:=Colors.Color[ahaIdentComplWindowEntryMethAbstract].Foreground; if IdentItem.TryIsAbstractMethod then
if iliHasLowerVisibility in IdentItem.Flags then AColor:=Colors.Color[ahaIdentComplWindowEntryMethAbstract].Foreground;
AColor:=Colors.Color[ahaIdentComplWindowEntryMethodLowVis].Foreground; if iliHasLowerVisibility in IdentItem.Flags then
AColor:=Colors.Color[ahaIdentComplWindowEntryMethodLowVis].Foreground;
end;
end; end;
end; end;
@ -482,7 +490,8 @@ begin
end end
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryProp].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryProp].Foreground;
s:='property'; s:='property';
if IsReadOnly then if IsReadOnly then
ImageIndex:=IDEImages.LoadImage('ce_property_readonly'); ImageIndex:=IDEImages.LoadImage('ce_property_readonly');
@ -495,7 +504,8 @@ begin
ImageIndexCC := IDEImages.LoadImage('cc_enum') ImageIndexCC := IDEImages.LoadImage('cc_enum')
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryEnum].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryEnum].Foreground;
s:='enum'; s:='enum';
end; end;
end; end;
@ -506,7 +516,8 @@ begin
ImageIndexCC := IDEImages.LoadImage('cc_label') ImageIndexCC := IDEImages.LoadImage('cc_label')
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryLabel].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryLabel].Foreground;
s:='label'; s:='label';
end; end;
end; end;
@ -517,7 +528,8 @@ begin
ImageIndexCC := IDEImages.LoadImage('cc_unit') ImageIndexCC := IDEImages.LoadImage('cc_unit')
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryUnit].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryUnit].Foreground;
s:='unit'; s:='unit';
end; end;
end; end;
@ -528,20 +540,23 @@ begin
ImageIndexCC := IDEImages.LoadImage('cc_namespace') ImageIndexCC := IDEImages.LoadImage('cc_namespace')
else else
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryNameSpace].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryNameSpace].Foreground;
s:='namespace'; s:='namespace';
end; end;
end; end;
ctnWord: ctnWord:
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryText].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryText].Foreground;
s:='text'; s:='text';
end; end;
ctnCodeTemplate: ctnCodeTemplate:
begin begin
AColor:=Colors.Color[ahaIdentComplWindowEntryTempl].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryTempl].Foreground;
s:='template'; s:='template';
end; end;
@ -549,16 +564,19 @@ begin
if not UseImages then if not UseImages then
begin begin
if iliKeyword in IdentItem.Flags then begin if iliKeyword in IdentItem.Flags then begin
AColor:=Colors.Color[ahaIdentComplWindowEntryKeyword].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryKeyword].Foreground;
s:='keyword'; s:='keyword';
end else begin end else begin
AColor:=Colors.Color[ahaIdentComplWindowEntryUnknown].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryUnknown].Foreground;
s:=''; s:='';
end; end;
end; end;
else else
AColor:=Colors.Color[ahaIdentComplWindowEntryUnknown].Foreground; if Colors <> nil then
AColor:=Colors.Color[ahaIdentComplWindowEntryUnknown].Foreground;
s:=''; s:='';
end; end;
if AColor = clNone then if AColor = clNone then