mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 18:39:52 +02:00
SynEdit: fix wrong horiz scroll at start
git-svn-id: trunk@25911 -
This commit is contained in:
parent
a895e51adb
commit
1ddbe4e5c3
@ -173,7 +173,7 @@ type
|
|||||||
sfEnsureCursorPos, sfEnsureCursorPosAtResize,
|
sfEnsureCursorPos, sfEnsureCursorPosAtResize,
|
||||||
sfIgnoreNextChar, sfPainting, sfHasScrolled,
|
sfIgnoreNextChar, sfPainting, sfHasScrolled,
|
||||||
sfScrollbarChanged, sfHorizScrollbarVisible, sfVertScrollbarVisible,
|
sfScrollbarChanged, sfHorizScrollbarVisible, sfVertScrollbarVisible,
|
||||||
sfAfterLoadFromFile,
|
sfAfterLoadFromFile, sfInHandleCreation,
|
||||||
// Mouse-states
|
// Mouse-states
|
||||||
sfDblClicked, sfGutterClick, sfTripleClicked, sfQuadClicked,
|
sfDblClicked, sfGutterClick, sfTripleClicked, sfQuadClicked,
|
||||||
sfWaitForDragging, sfIsDragging, sfMouseSelecting, sfMouseDoneSelecting,
|
sfWaitForDragging, sfIsDragging, sfMouseSelecting, sfMouseDoneSelecting,
|
||||||
@ -372,6 +372,7 @@ type
|
|||||||
fLinesInWindow: Integer;// MG: fully visible lines in window
|
fLinesInWindow: Integer;// MG: fully visible lines in window
|
||||||
fLeftChar: Integer; // first visible screen column
|
fLeftChar: Integer; // first visible screen column
|
||||||
fMaxLeftChar: Integer; // 1024
|
fMaxLeftChar: Integer; // 1024
|
||||||
|
FOldWitdth, FOldHeight: Integer;
|
||||||
|
|
||||||
FPaintLock: Integer;
|
FPaintLock: Integer;
|
||||||
FPaintLockOwnerCnt: Integer;
|
FPaintLockOwnerCnt: Integer;
|
||||||
@ -1575,6 +1576,8 @@ begin
|
|||||||
FCaret.Lines := FTheLinesView;
|
FCaret.Lines := FTheLinesView;
|
||||||
FInternalCaret.Lines := FTheLinesView;
|
FInternalCaret.Lines := FTheLinesView;
|
||||||
FFontDummy := TFont.Create;
|
FFontDummy := TFont.Create;
|
||||||
|
FOldWitdth := -1;
|
||||||
|
FOldHeight := -1;
|
||||||
|
|
||||||
with TSynEditStringList(fLines) do begin
|
with TSynEditStringList(fLines) do begin
|
||||||
AddChangeHandler(senrLineCount, {$IFDEF FPC}@{$ENDIF}LineCountChanged);
|
AddChangeHandler(senrLineCount, {$IFDEF FPC}@{$ENDIF}LineCountChanged);
|
||||||
@ -4113,12 +4116,16 @@ end;
|
|||||||
procedure TCustomSynEdit.CreateHandle;
|
procedure TCustomSynEdit.CreateHandle;
|
||||||
begin
|
begin
|
||||||
Application.RemoveOnIdleHandler(@IdleScanRanges);
|
Application.RemoveOnIdleHandler(@IdleScanRanges);
|
||||||
|
// A Resize will be received after CreateHandle is finished
|
||||||
|
// Resizes during CreateHandle may be wrong
|
||||||
|
include(fStateFlags, sfInHandleCreation);
|
||||||
DoIncPaintLock(nil);
|
DoIncPaintLock(nil);
|
||||||
try
|
try
|
||||||
inherited CreateHandle; //SizeOrFontChanged will be called
|
inherited CreateHandle; //SizeOrFontChanged will be called
|
||||||
Include(fStateFlags, sfScrollbarChanged);
|
Include(fStateFlags, sfScrollbarChanged);
|
||||||
finally
|
finally
|
||||||
DoDecPaintLock(nil);
|
DoDecPaintLock(nil);
|
||||||
|
exclude(fStateFlags, sfInHandleCreation);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4523,6 +4530,9 @@ end;
|
|||||||
procedure TCustomSynEdit.Resize;
|
procedure TCustomSynEdit.Resize;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
if (not HandleAllocated) or ((Width = FOldWitdth) and (Height = FOldHeight)) then exit;
|
||||||
|
FOldWitdth := Width;
|
||||||
|
FOldHeight := Height;
|
||||||
SizeOrFontChanged(FALSE);
|
SizeOrFontChanged(FALSE);
|
||||||
if sfEnsureCursorPosAtResize in fStateFlags then
|
if sfEnsureCursorPosAtResize in fStateFlags then
|
||||||
EnsureCursorPosVisible;
|
EnsureCursorPosVisible;
|
||||||
@ -5670,6 +5680,7 @@ begin
|
|||||||
(not (eoAlwaysVisibleCaret in fOptions2))
|
(not (eoAlwaysVisibleCaret in fOptions2))
|
||||||
then
|
then
|
||||||
exit;
|
exit;
|
||||||
|
if (sfInHandleCreation in fStateFlags) or (not HandleAllocated) then exit;
|
||||||
|
|
||||||
if (fPaintLock > 0) or (not HandleAllocated) or
|
if (fPaintLock > 0) or (not HandleAllocated) or
|
||||||
(FWinControlFlags * [wcfInitializing, wcfCreatingHandle] <> [])
|
(FWinControlFlags * [wcfInitializing, wcfCreatingHandle] <> [])
|
||||||
|
Loading…
Reference in New Issue
Block a user