Ide, Codetools: IdentifierCompletion, add color for recent Items. Issue #40392 Based(Amended) on Patch by Bruno K

This commit is contained in:
Martin 2023-07-21 21:20:35 +02:00
parent b087b9f55e
commit 4f1297912a
6 changed files with 37 additions and 6 deletions

View File

@ -105,7 +105,8 @@ type
iliIsLibrary,
iliAtCursor, // the item is the identifier at the completion
iliNeedsAmpersand, //the item has to be prefixed with '&'
iliHasLowerVisibility
iliHasLowerVisibility,
iliIsRecentItem // the item was sorted to the front as it was recently used
);
TIdentListItemFlags = set of TIdentListItemFlag;
@ -712,8 +713,10 @@ var
Continue;
if (CurItem.HistoryIndex > HistoryLimits[CurItmComp]) then
break;
if (CurItem.Identifier<>'') and (FilterCurItem >= 0) then
if (CurItem.Identifier<>'') and (FilterCurItem >= 0) then begin
CurItem.Flags := CurItem.Flags + [iliIsRecentItem];
InsertCurItem;
end;
end;
end;
@ -780,8 +783,10 @@ begin
{$IFDEF ShowFilteredIdents}
DebugLn(['::: FILTERED ITEM ',FFilteredList.Count,' ',CurItem.Identifier]);
{$ENDIF}
if CurItem.HistoryIndex > HistoryLimits[CurItmComp] then
if CurItem.HistoryIndex > HistoryLimits[CurItmComp] then begin
CurItem.Flags := CurItem.Flags - [iliIsRecentItem];
InsertCurItem;
end;
end
else if i>0 then begin
{$IFDEF ShowFilteredIdents}

View File

@ -126,7 +126,7 @@ const
'', '', // ahaCaretColor, ahaOverviewGutter
'', '', '', // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
'', '', '', // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
'', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
'', '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplRecent, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
'', '', '', '', '', '', '', '', '', '' // ahaOutlineLevel1Color..ahaOutlineLevel10Color
);
@ -174,6 +174,7 @@ const
{ ahaIfDefNodeTmpActive } agnIfDef,
{ ahaIdentComplWindow } agnIdentComplWindow,
{ ahaIdentComplWindowBorder } agnIdentComplWindow,
{ ahaIdentComplRecent } agnIdentComplWindow,
{ ahaIdentComplWindowSelection } agnIdentComplWindow,
{ ahaIdentComplWindowHighlight } agnIdentComplWindow,
{ ahaOutlineLevel1Color } agnOutlineColors,
@ -233,6 +234,7 @@ const
{ ahaIfDefNodeTmpActive } [hafBackColor, hafForeColor, hafFrameColor, hafAlpha, hafPrior, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaIdentComplWindow } [hafBackColor, hafForeColor],
{ ahaIdentComplWindowBorder } [hafForeColor],
{ ahaIdentComplRecent} [hafForeColor],
{ ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
{ ahaIdentComplWindowHighlight } [hafForeColor],
{ ahaFoldLevel1Color } [hafBackColor, hafForeColor, hafFrameColor, hafAlpha, hafPrior, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask, hafMarkupFoldColor],
@ -2723,6 +2725,7 @@ begin
AdditionalHighlightAttributes[ahaIdentComplWindow] := dlgAddHiAttrDefaultWindow;
AdditionalHighlightAttributes[ahaIdentComplWindowBorder] := dlgAddHiAttrWindowBorder;
AdditionalHighlightAttributes[ahaIdentComplRecent] := dlgAddHiAttrRecentlyUsed;
AdditionalHighlightAttributes[ahaIdentComplWindowSelection] := dlgBlockGroupOptions;
AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
AdditionalHighlightGroupNames[agnIdentComplWindow] := dlgIdentifierCompletion;
@ -6903,6 +6906,12 @@ begin
else
IDESynEdit.MarkupIdentComplWindow.BorderColor:= clNone;
Attri := GetUsedAttr(ahaIdentComplRecent);
if Attri<>nil then
IDESynEdit.MarkupIdentComplWindow.HistoryTextColor := Attri.Foreground
else
IDESynEdit.MarkupIdentComplWindow.HistoryTextColor := clNone;
Attri := GetUsedAttr(ahaIdentComplWindowHighlight);
if Attri<>nil then
IDESynEdit.MarkupIdentComplWindow.HighlightColor:= Attri.Foreground

View File

@ -2157,6 +2157,7 @@ resourcestring
dlgAddHiAttrSyncroEditArea = 'Selected Area';
dlgAddHiAttrGutterSeparator = 'Gutter Separator';
dlgAddHiAttrDefaultWindow = 'Default Text / Window';
dlgAddHiAttrRecentlyUsed = 'Recently used item';
dlgAddHiAttrWindowBorder = 'Window border';
dlgAddHiAttrHighlightPrefix = 'Highlight prefix';
dlgAddHiAttrOutlineLevel1Color = 'Level 1';

View File

@ -135,6 +135,7 @@ type
FActiveEditBackgroundSelectedColor: TColor;
FActiveEditBorderColor: TColor;
FActiveEditTextColor: TColor;
FActiveHistoryTextColor: TColor;
FActiveEditTextSelectedColor: TColor;
FActiveEditTextHighLightColor: TColor;
@ -2427,6 +2428,7 @@ Begin
{$ENDIF}
TheForm.Font := Editor.Font;
FActiveHistoryTextColor := clNone;
FActiveEditTextColor := Editor.Font.Color;
FActiveEditBorderColor := RGBToColor(200, 200, 200);
FActiveEditBackgroundColor := Editor.Color;
@ -2462,6 +2464,8 @@ Begin
FActiveEditBackgroundSelectedColor := SynEditor.MarkupIdentComplWindow.BackgroundSelectedColor;
if SynEditor.MarkupIdentComplWindow.HighlightColor<>clNone then
FActiveEditTextHighLightColor := SynEditor.MarkupIdentComplWindow.HighlightColor;
if SynEditor.MarkupIdentComplWindow.HistoryTextColor<>clNone then
FActiveHistoryTextColor:=SynEditor.MarkupIdentComplWindow.HistoryTextColor;
end;
SL := TStringList.Create;
@ -2721,9 +2725,18 @@ begin
end;
Font.Style:=[];
end;
if CodeToolBoss.IdentifierList.SortForHistory and
(iliIsRecentItem in CodeToolBoss.IdentifierList.FilteredItems[Index].Flags) and
(FActiveHistoryTextColor <> clNone)
then begin
Colors.TextColor := FActiveHistoryTextColor; // - to display history items
end else begin
Colors.TextColor := FActiveEditTextColor;
end;
Colors.BackgroundColor := FActiveEditBackgroundColor;
Colors.BackgroundSelectedColor := FActiveEditBackgroundSelectedColor;
Colors.TextColor := FActiveEditTextColor;
Colors.TextSelectedColor := FActiveEditTextSelectedColor;
Colors.TextHilightColor := FActiveEditTextHighLightColor;
MaxX:=TheForm.ClientWidth;

View File

@ -66,7 +66,7 @@ type
ahaTopInfoHint, ahaCaretColor, ahaOverviewGutter,
ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplRecent, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
ahaOutlineLevel1Color, ahaOutlineLevel2Color, ahaOutlineLevel3Color, ahaOutlineLevel4Color, ahaOutlineLevel5Color, ahaOutlineLevel6Color, ahaOutlineLevel7Color, ahaOutlineLevel8Color, ahaOutlineLevel9Color, ahaOutlineLevel10Color
);

View File

@ -226,6 +226,7 @@ type
FBorderColor: TColor;
FHighlightColor: TColor;
FTextColor: TColor;
FHistoryTextColor: TColor;
FTextSelectedColor: TColor;
FWindowColor: TColor;
public
@ -233,6 +234,7 @@ type
public
property WindowColor: TColor read FWindowColor write FWindowColor;
property TextColor: TColor read FTextColor write FTextColor;
property HistoryTextColor: TColor read FHistoryTextColor write FHistoryTextColor;
property BorderColor: TColor read FBorderColor write FBorderColor;
property HighlightColor: TColor read FHighlightColor write FHighlightColor;
property TextSelectedColor: TColor read FTextSelectedColor write FTextSelectedColor;
@ -519,6 +521,7 @@ begin
FBorderColor := clNone;
FHighlightColor := clNone;
FTextColor := clNone;
FHistoryTextColor := clNone;
FTextSelectedColor := clNone;
FWindowColor := clNone;
end;