Skip to content

Commit

Permalink
better update client sizes of toggling scrollbars
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed May 31, 2020
1 parent fcada9a commit e19a68b
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions atsynedit/atsynedit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,7 @@ TATSynEdit = class(TCustomControl)
procedure UpdateMinimapAutosize;
procedure UpdateMinimapTooltip;
procedure UpdateFoldedMarkTooltip;
procedure UpdateClientSizes;
function DoFormatLineNumber(N: integer): string;
function UpdateScrollInfoFromMessage(var Info: TATSynScrollInfo; const Msg: TLMScroll): boolean;
function UpdateScrollbars(AdjustSmoothPos: boolean): boolean;
Expand Down Expand Up @@ -2149,8 +2150,9 @@ procedure TATSynEdit.SetWrapIndented(AValue: boolean);

function TATSynEdit.UpdateScrollbars(AdjustSmoothPos: boolean): boolean;
var
bVert1, bVert2,
bHorz1, bHorz2: boolean;
bVert1, bVert2, bHorz1, bHorz2: boolean;
bVertOur1, bVertOur2, bHorzOur1, bHorzOur2: boolean;
bChangedBarsOs, bChangedBarsOur: boolean;
NPos, NLineIndex, NGapPos, NGapAll: integer;
begin
Result:= false;
Expand Down Expand Up @@ -2208,13 +2210,23 @@ function TATSynEdit.UpdateScrollbars(AdjustSmoothPos: boolean): boolean;

bVert1:= ShowOsBarVert;
bHorz1:= ShowOsBarHorz;
bVertOur1:= FScrollbarVert.Visible;
bHorzOur1:= FScrollbarHorz.Visible;

UpdateScrollbarVert;
UpdateScrollbarHorz;

bVert2:= ShowOsBarVert;
bHorz2:= ShowOsBarHorz;
Result:= (bVert1<>bVert2) or (bHorz1<>bHorz2);
bVertOur2:= FScrollbarVert.Visible;
bHorzOur2:= FScrollbarHorz.Visible;

bChangedBarsOs:= (bVert1<>bVert2) or (bHorz1<>bHorz2);
bChangedBarsOur:= (bVertOur1<>bVertOur2) or (bHorzOur1<>bHorzOur2);
Result:= bChangedBarsOs;

if bChangedBarsOs or bChangedBarsOur then
UpdateClientSizes;

if (FPrevHorz<>FScrollHorz) or
(FPrevVert<>FScrollVert) then
Expand Down Expand Up @@ -2427,9 +2439,14 @@ procedure TATSynEdit.GetRectRuler(out R: TRect);
R.Bottom:= R.Top + FRulerHeight;
end;

procedure TATSynEdit.UpdateInitialVars(C: TCanvas);
procedure TATSynEdit.UpdateClientSizes;
begin
GetClientSizes(FClientW, FClientH);
end;

procedure TATSynEdit.UpdateInitialVars(C: TCanvas);
begin
UpdateClientSizes;

C.Font.Name:= Font.Name;
C.Font.Size:= DoScaleFont(Font.Size);
Expand Down

0 comments on commit e19a68b

Please sign in to comment.