IDE: code help: fixed conversion of line endings to unix line endings

git-svn-id: trunk@21412 -
This commit is contained in:
mattias 2009-08-22 22:44:23 +00:00
parent 287d754ed2
commit 5c1e94e909

View File

@ -319,20 +319,21 @@ var
begin begin
Result:=s; Result:=s;
p:=1; p:=1;
while (p<=length(s)) do begin while (p<=length(Result)) do begin
if not (s[p] in [#10,#13]) then begin case Result[p] of
inc(p); #10:
end else begin if (p<length(Result)) and (Result[p+1] in [#10,#13])
// line ending and (Result[p]<>Result[p+1]) then begin
if (p<length(s)) and (s[p+1] in [#10,#13]) and (s[p]<>s[p+1]) then begin
// double character line ending // double character line ending
Result:=copy(Result,1,p-1)+#10+copy(Result,p+2,length(Result)); System.Delete(Result,p,2);
end else if s[p]=#13 then begin end;
#13:
begin
// single char line ending #13 // single char line ending #13
Result[p]:=#10; Result[p]:=#10;
end; end;
inc(p);
end; end;
inc(p);
end; end;
end; end;