mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 10:19:28 +02:00
IDE: completion: fixed range check error
git-svn-id: trunk@58139 -
This commit is contained in:
parent
a9731bdd6d
commit
9715cc6e22
@ -2415,7 +2415,7 @@ begin
|
|||||||
Colors.BackgroundSelectedColor := FActiveEditBackgroundSelectedColor;
|
Colors.BackgroundSelectedColor := FActiveEditBackgroundSelectedColor;
|
||||||
Colors.TextColor := FActiveEditTextColor;
|
Colors.TextColor := FActiveEditTextColor;
|
||||||
Colors.TextSelectedColor := FActiveEditTextSelectedColor;
|
Colors.TextSelectedColor := FActiveEditTextSelectedColor;
|
||||||
Colors.TextHighLightColor := FActiveEditTextHighLightColor;
|
Colors.TextHilightColor := FActiveEditTextHighLightColor;
|
||||||
MaxX:=TheForm.ClientWidth;
|
MaxX:=TheForm.ClientWidth;
|
||||||
t:=CurrentCompletionType;
|
t:=CurrentCompletionType;
|
||||||
if Manager.ActiveCompletionPlugin<>nil then
|
if Manager.ActiveCompletionPlugin<>nil then
|
||||||
|
@ -102,7 +102,7 @@ type
|
|||||||
BackgroundSelectedColor: TColor;
|
BackgroundSelectedColor: TColor;
|
||||||
TextColor: TColor;
|
TextColor: TColor;
|
||||||
TextSelectedColor: TColor;
|
TextSelectedColor: TColor;
|
||||||
TextHighLightColor: TColor;
|
TextHilightColor: TColor;
|
||||||
end;
|
end;
|
||||||
PPaintCompletionItemColors = ^TPaintCompletionItemColors;
|
PPaintCompletionItemColors = ^TPaintCompletionItemColors;
|
||||||
|
|
||||||
@ -163,6 +163,7 @@ var
|
|||||||
TokenStart: Integer;
|
TokenStart: Integer;
|
||||||
BackgroundColor: TColorRef;
|
BackgroundColor: TColorRef;
|
||||||
ForegroundColor: TColorRef;
|
ForegroundColor: TColorRef;
|
||||||
|
TextHilightColor: TColorRef;
|
||||||
AllowFontColor: Boolean;
|
AllowFontColor: Boolean;
|
||||||
|
|
||||||
procedure SetFontColor(NewColor: TColor; Force: boolean = false);
|
procedure SetFontColor(NewColor: TColor; Force: boolean = false);
|
||||||
@ -292,22 +293,24 @@ begin
|
|||||||
begin
|
begin
|
||||||
if ItemSelected then
|
if ItemSelected then
|
||||||
begin
|
begin
|
||||||
ForegroundColor := Colors^.TextSelectedColor;
|
ForegroundColor := ColorToRGB(Colors^.TextSelectedColor);
|
||||||
AllowFontColor := ForegroundColor=clNone;
|
AllowFontColor := ForegroundColor=clNone;
|
||||||
if ForegroundColor=clNone then
|
if ForegroundColor=clNone then
|
||||||
ForegroundColor := Colors^.TextColor;
|
ForegroundColor := Colors^.TextColor;
|
||||||
BackgroundColor:=ColorToRGB(Colors^.BackgroundSelectedColor);
|
BackgroundColor:=ColorToRGB(Colors^.BackgroundSelectedColor);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
ForegroundColor := Colors^.TextColor;
|
ForegroundColor := ColorToRGB(Colors^.TextColor);
|
||||||
AllowFontColor := True;
|
AllowFontColor := True;
|
||||||
BackgroundColor:=ColorToRGB(Colors^.BackgroundColor);
|
BackgroundColor:=ColorToRGB(Colors^.BackgroundColor);
|
||||||
end;
|
end;
|
||||||
|
TextHilightColor:=ColorToRGB(Colors^.TextHilightColor);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
ForegroundColor := clBlack;
|
ForegroundColor := clBlack;
|
||||||
AllowFontColor := True;
|
AllowFontColor := True;
|
||||||
BackgroundColor:=ColorToRGB(ACanvas.Brush.Color);
|
BackgroundColor:=ColorToRGB(ACanvas.Brush.Color);
|
||||||
|
TextHilightColor := clWhite;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
BGRed:=(BackgroundColor shr 16) and $ff;
|
BGRed:=(BackgroundColor shr 16) and $ff;
|
||||||
@ -538,7 +541,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
//DebugLn(['PaintCompletionItem ',x,',',y,' ',s]);
|
//DebugLn(['PaintCompletionItem ',x,',',y,' ',s]);
|
||||||
// highlighting the prefix
|
// highlighting the prefix
|
||||||
if (Colors<>nil) and (Colors^.TextHighLightColor<>clNone)
|
if (Colors<>nil) and (TextHilightColor<>clNone)
|
||||||
and (aCompletion.CurrentString<>'') then
|
and (aCompletion.CurrentString<>'') then
|
||||||
begin
|
begin
|
||||||
PrefixPosition := Pos(LowerCase(aCompletion.CurrentString), LowerCase(s));
|
PrefixPosition := Pos(LowerCase(aCompletion.CurrentString), LowerCase(s));
|
||||||
@ -548,7 +551,7 @@ begin
|
|||||||
Token := Copy(s, 1, PrefixPosition-1);
|
Token := Copy(s, 1, PrefixPosition-1);
|
||||||
ACanvas.TextOut(x+1,y,Token);
|
ACanvas.TextOut(x+1,y,Token);
|
||||||
// paint highlight prefix
|
// paint highlight prefix
|
||||||
SetFontColor(ColorToRGB(Colors^.TextHighLightColor));
|
SetFontColor(TextHilightColor);
|
||||||
Token := Copy(s, PrefixPosition, Length(aCompletion.CurrentString));
|
Token := Copy(s, PrefixPosition, Length(aCompletion.CurrentString));
|
||||||
ACanvas.TextOut(x+1+ACanvas.TextWidth(Copy(s, 1, PrefixPosition-1)),y,Token);
|
ACanvas.TextOut(x+1+ACanvas.TextWidth(Copy(s, 1, PrefixPosition-1)),y,Token);
|
||||||
// paint after prefix
|
// paint after prefix
|
||||||
|
Loading…
Reference in New Issue
Block a user