SourceEdit: when file changed on disc: keep topline / revert 36226 #77d9a604b6

git-svn-id: trunk@36227 -
This commit is contained in:
martin 2012-03-22 18:28:03 +00:00
parent 77d9a604b6
commit 6a79dbc976
3 changed files with 7 additions and 10 deletions

View File

@ -4692,12 +4692,14 @@ end;
procedure TCustomSynEdit.SetTopView(AValue : Integer);
begin
// don't use MinMax here, it will fail in design mode (Lines.Count is zero,
// don't use MinMax here, it will fail in design mode (Lines.Count is zero,
// but the painting code relies on TopLine >= 1)
{$IFDEF SYNSCROLLDEBUG}
if (fPaintLock = 0) and (not FIsInDecPaintLock) then debugln(['SetTopView outside Paintlock New=',AValue, ' Old=', FFoldedLinesView.TopLine]);
if (sfHasScrolled in fStateFlags) then debugln(['SetTopView with sfHasScrolled Value=',AValue, ' FOldTopView=',FOldTopView ]);
{$ENDIF}
TSynEditStringList(FLines).SendCachedNotify; // TODO: review
AValue := Min(AValue, CurrentMaxTopView);
AValue := Max(AValue, 1);

View File

@ -159,7 +159,6 @@ type
procedure InsertItem(Index: integer; const S: string);
procedure SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
procedure SetModified(const AValue: Boolean);
procedure SendCachedNotify;
protected
function GetExpandedString(Index: integer): string; override;
function GetLengthOfLongestLine: integer; override;
@ -228,6 +227,7 @@ type
property AttachedSynEdits[Index: Integer]: TSynEditBase read GetAttachedSynEdits;
procedure CopyHanlders(OtherLines: TSynEditStringList; AOwner: TObject = nil);
procedure RemoveHanlders(AOwner: TObject);
procedure SendCachedNotify; // ToDO: review caghing versus changes to topline and other values
public
property DosFileFormat: boolean read fDosFileFormat write fDosFileFormat;
property LengthOfLongestLine: integer read GetLengthOfLongestLine;
@ -1037,10 +1037,11 @@ end;
procedure TSynEditStringList.SendCachedNotify;
begin
//debugln(['--- send cached notify ', FCachedNotifyStart,' / ',FCachedNotifyCount]);
if FCachedNotifyCount <> 0 then;
if (FCachedNotifyCount <> 0) and FCachedNotify then begin
FCachedNotify := False;
TLineRangeNotificationList(FNotifyLists[senrLineCount])
.CallRangeNotifyEvents(FCachedNotifySender, FCachedNotifyStart, FCachedNotifyCount);
FCachedNotify := False;
end;
end;
procedure TSynEditStringList.MarkModified(AFirst, ALast: Integer);

View File

@ -2239,8 +2239,6 @@ var
StartPos, EndPos, MoveToPos: TPoint;
CodeToolsInSync: Boolean;
i: Integer;
CarXY: TPoint;
TopL: Integer;
begin
{$IFDEF IDE_DEBUG}
debugln(['[TSourceEditor.OnCodeBufferChanged] A ',FIgnoreCodeBufferLock,' ',SrcLogEntry<>nil]);
@ -2249,8 +2247,6 @@ begin
DebugBoss.LockCommandProcessing;
SynEditor.BeginUpdate;
try
CarXY := SynEditor.CaretXY;
TopL := SynEditor.TopLine;
CodeToolsInSync:=not NeedsUpdateCodeBuffer;
if SrcLogEntry<>nil then begin
SynEditor.BeginUndoBlock{$IFDEF SynUndoDebugBeginEnd}('TSourceEditorSharedValues.OnCodeBufferChanged'){$ENDIF};
@ -2314,8 +2310,6 @@ begin
FEditorStampCommitedToCodetools:=TSynEditLines(SynEditor.Lines).TextChangeStamp;
end;
finally
SynEditor.CaretXY := CarXY;
SynEditor.TopLine := TopL;
SynEditor.EndUpdate;
DebugBoss.UnLockCommandProcessing;
end;