SourceEdit: when file changed on disc: keep topline

git-svn-id: trunk@36226 -
This commit is contained in:
martin 2012-03-22 18:02:24 +00:00
parent 575e24d917
commit 77d9a604b6

View File

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