IDE, SourceEditor: Fix vertical scrolling of newly opened files, introduced by revision 22549 #ba1566e224 ( Defer switching notebook-tab ... )

git-svn-id: trunk@22554 -
This commit is contained in:
martin 2009-11-13 01:06:51 +00:00
parent 8e593d7601
commit aa67f8e364

View File

@ -7267,6 +7267,19 @@ begin
except
MessageDlg(lisError, lisFailedToLoadFoldStat, mtError, [mbOK], 0);
end;
// Setting the PageIndex causes painting:
// It must be done after setting the highlighter
// It must be done before setting the Caret or Leftchar may be wrongly adjusted, becaues the PageControl only resizes on show
if NewSrcEditorCreated then begin
// avoid flicker, by painting the correct text already
NewSrcEdit.EditorComponent.TopLine:=NewTopLine;
NewSrcEdit.EditorComponent.LeftChar:=NewLeftChar;
NewSrcEdit.EditorComponent.EndUpdate;
SourceNotebook.Notebook.PageIndex := AnUnitInfo.EditorIndex;
NewSrcEdit.EditorComponent.BeginUpdate;
end;
NewSrcEdit.EditorComponent.CaretXY:=NewCaretXY;
NewSrcEdit.EditorComponent.TopLine:=NewTopLine;
NewSrcEdit.EditorComponent.LeftChar:=NewLeftChar;
@ -7275,12 +7288,6 @@ begin
NewSrcEdit.ReadOnly:=AnUnitInfo.ReadOnly;
NewSrcEdit.Modified:=false;
// Setting the PageIndex causes painting:
// It must be done after setting the highlighter
// it must be done before SynEdit.EndUpdate, otherwise Leftchar may be wrongly adjusted
if NewSrcEditorCreated then
SourceNotebook.Notebook.PageIndex := AnUnitInfo.EditorIndex;
// mark unit as loaded
NewSrcEdit.EditorComponent.EndUpdate;
AnUnitInfo.Loaded:=true;