Fixed bug #8566 - Pretty Format saves file unwantedly

git-svn-id: trunk@10820 -
This commit is contained in:
andrew 2007-03-28 17:02:15 +00:00
parent 07f94a00c2
commit 932397fb09

View File

@ -118,7 +118,8 @@ end;
Procedure PrettyPrintFile(Sender : TObject); Procedure PrettyPrintFile(Sender : TObject);
Var Var
S1,S2 : TMemoryStream; S1 : TMemoryStream;
S2 : TStringStream;
E : TSourceEditorInterface; E : TSourceEditorInterface;
begin begin
@ -130,11 +131,11 @@ begin
Try Try
E.Lines.SaveToStream(S1); E.Lines.SaveToStream(S1);
S1.Position:=0; S1.Position:=0;
S2:=TMemoryStream.Create; S2:=TStringStream.Create('');
Try Try
PrettyPrintStream(S1,S2); PrettyPrintStream(S1,S2);
S2.Position:=0; S2.Position:=0;
E.Lines.LoadFromStream(S2); E.ReplaceLines(0, E.LineCount, S2.DataString);
Finally Finally
S2.Free; S2.Free;
end; end;