mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 01:06:02 +02:00
SynEdit,SyncroEdit: Fixed CPU usage (editor redraw) while inactive. Issue #14191 (fix scrolling)
git-svn-id: trunk@20957 -
This commit is contained in:
parent
550c334bc3
commit
b38412dbee
@ -135,6 +135,7 @@ type
|
||||
FGutterGlyph: TBitmap;
|
||||
function GetGutterGlyphRect(aLine: Integer): TRect;
|
||||
function GetGutterGlyphRect: TRect;
|
||||
function GetGutterGlyphPaintLine: Integer;
|
||||
procedure SetGlyphAtLine(const AValue: Integer);
|
||||
procedure SetGutterGlyph(const AValue: TBitmap);
|
||||
procedure DoInvalidate;
|
||||
@ -720,7 +721,7 @@ begin
|
||||
end;
|
||||
rcInval := GetGutterGlyphRect;
|
||||
// and make sure we trigger the Markup // TODO: triigger markup on gutter paint too
|
||||
rcInval.Right := TSynEdit(SynEdit).GutterWidth + 2;
|
||||
rcInval.Right := Max(rcInval.Right, TSynEdit(SynEdit).GutterWidth + 2);
|
||||
InvalidateRect(SynEdit.Handle, @rcInval, False);
|
||||
end;
|
||||
|
||||
@ -731,8 +732,15 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSynPluginSyncroEditMarkup.DoTopLineChanged(OldTopLine: Integer);
|
||||
var
|
||||
rcInval: TRect;
|
||||
begin
|
||||
inherited DoTopLineChanged(OldTopLine);
|
||||
// Glyph may have drawn up to one Line above
|
||||
if FGlyphLastLine > 1 then begin
|
||||
rcInval := GetGutterGlyphRect(FGlyphLastLine - 1);
|
||||
InvalidateRect(SynEdit.Handle, @rcInval, False);
|
||||
end;
|
||||
DoInvalidate;
|
||||
end;
|
||||
|
||||
@ -766,9 +774,7 @@ begin
|
||||
if (FGutterGlyph.Height > 0) then begin
|
||||
src := Classes.Rect(0, 0, FGutterGlyph.Width, FGutterGlyph.Height);
|
||||
dst := GutterGlyphRect;
|
||||
FGlyphLastLine := FGlyphAtLine;
|
||||
if FGlyphLastLine < 0 then
|
||||
FGlyphLastLine := TSynEdit(SynEdit).CaretY;
|
||||
FGlyphLastLine := GetGutterGlyphPaintLine;
|
||||
TSynEdit(SynEdit).Canvas.CopyRect(dst, FGutterGlyph.Canvas, src);
|
||||
end;
|
||||
end;
|
||||
@ -799,6 +805,20 @@ begin
|
||||
Result := GetGutterGlyphRect(GlyphAtLine);
|
||||
end;
|
||||
|
||||
function TSynPluginSyncroEditMarkup.GetGutterGlyphPaintLine: Integer;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := FGlyphAtLine;
|
||||
if Result < 0 then
|
||||
Result := TSynEdit(SynEdit).CaretY;
|
||||
if Result < TopLine then
|
||||
Result := TopLine;
|
||||
i := ScreenRowToRow(LinesInWindow);
|
||||
if Result > i then
|
||||
Result := i;
|
||||
end;
|
||||
|
||||
procedure TSynPluginSyncroEditMarkup.SetGlyphAtLine(const AValue: Integer);
|
||||
begin
|
||||
if FGlyphAtLine = AValue then exit;
|
||||
|
Loading…
Reference in New Issue
Block a user