diff --git a/components/codetools/laz_xmlread.pas b/components/codetools/laz_xmlread.pas index de8bb88868..23b38f6ef0 100644 --- a/components/codetools/laz_xmlread.pas +++ b/components/codetools/laz_xmlread.pas @@ -263,9 +263,11 @@ begin x := 1; y := 1; while apos < buf do begin - if apos[0] = #10 then begin + if apos^ in [#10,#13] then begin Inc(y); x := 1; + if (apos[1] in [#10,#13]) and (apos[0]<>apos[1]) then + inc(apos); end else Inc(x); Inc(apos); diff --git a/components/codetools/laz_xmlwrite.pas b/components/codetools/laz_xmlwrite.pas index c96e3ed895..8843dfd0a4 100644 --- a/components/codetools/laz_xmlwrite.pas +++ b/components/codetools/laz_xmlwrite.pas @@ -65,6 +65,7 @@ const (@WriteElement, @WriteAttribute, @WriteText, @WriteCDATA, @WriteEntityRef, @WriteEntity, @WritePI, @WriteComment, @WriteDocument, @WriteDocumentType, @WriteDocumentFragment, @WriteNotation); + LineEnd: shortstring = LineEnding; procedure WriteNode(node: TDOMNode); begin @@ -116,7 +117,7 @@ procedure Stream_WriteLn(const Buffer; Count: Longint); begin if Count > 0 then begin stream.Write(Buffer, Count); - stream.WriteByte(10); + stream.Write(LineEnd[1],length(LineEnd)); end; end; @@ -139,7 +140,7 @@ end; procedure wrtLineEnd; begin - wrt(#10,1); + wrt(LineEnd[1],length(LineEnd)); end; // -------------------------------------------------------------------