IDE: fixed TSourceNotebook.ReloadHighlighters using wrong PageIndex

git-svn-id: trunk@22172 -
This commit is contained in:
mattias 2009-10-14 12:37:57 +00:00
parent 39fd8546c7
commit 5c3bf6fbea
2 changed files with 4 additions and 3 deletions

View File

@ -3102,6 +3102,7 @@ end;
function TProject.UnitWithEditorIndex(Index:integer):TUnitInfo; function TProject.UnitWithEditorIndex(Index:integer):TUnitInfo;
begin begin
if Index<0 then exit(nil);
Result:=fFirst[uilWithEditorIndex]; Result:=fFirst[uilWithEditorIndex];
while (Result<>nil) and (Result.EditorIndex<>Index) do begin while (Result<>nil) and (Result.EditorIndex<>Index) do begin
Result:=Result.fNext[uilWithEditorIndex]; Result:=Result.fNext[uilWithEditorIndex];

View File

@ -672,7 +672,7 @@ type
procedure ShowFPDocEditor; procedure ShowFPDocEditor;
procedure UpdateFPDocEditor; procedure UpdateFPDocEditor;
property Editors[Index:integer]:TSourceEditor read GetEditors; property Editors[Index:integer]:TSourceEditor read GetEditors; // !!! not ordered for PageIndex
function EditorCount:integer; function EditorCount:integer;
function Count: integer; override; function Count: integer; override;
function Empty: boolean; function Empty: boolean;
@ -5394,7 +5394,7 @@ var
begin begin
try try
TheFileList:= TStringList.Create; TheFileList:= TStringList.Create;
for i:= 0 to self.EditorCount -1 do for i:= 0 to EditorCount -1 do
begin begin
//only if file exists on disk //only if file exists on disk
if FilenameIsAbsolute(Editors[i].FileName) and if FilenameIsAbsolute(Editors[i].FileName) and
@ -6622,7 +6622,7 @@ var
begin begin
for i := 0 to EditorCount-1 do begin for i := 0 to EditorCount-1 do begin
ASrcEdit:=Editors[i]; ASrcEdit:=Editors[i];
AnUnitInfo:=Project1.UnitWithEditorIndex(i); AnUnitInfo:=Project1.UnitWithEditorIndex(ASrcEdit.PageIndex);
if AnUnitInfo<>nil then if AnUnitInfo<>nil then
ASrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter; ASrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
end; end;