mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 05:21:27 +02:00
IDE: code help: fixed conversion of line endings to unix line endings
git-svn-id: trunk@21412 -
This commit is contained in:
parent
287d754ed2
commit
5c1e94e909
@ -319,20 +319,21 @@ var
|
||||
begin
|
||||
Result:=s;
|
||||
p:=1;
|
||||
while (p<=length(s)) do begin
|
||||
if not (s[p] in [#10,#13]) then begin
|
||||
inc(p);
|
||||
end else begin
|
||||
// line ending
|
||||
if (p<length(s)) and (s[p+1] in [#10,#13]) and (s[p]<>s[p+1]) then begin
|
||||
while (p<=length(Result)) do begin
|
||||
case Result[p] of
|
||||
#10:
|
||||
if (p<length(Result)) and (Result[p+1] in [#10,#13])
|
||||
and (Result[p]<>Result[p+1]) then begin
|
||||
// double character line ending
|
||||
Result:=copy(Result,1,p-1)+#10+copy(Result,p+2,length(Result));
|
||||
end else if s[p]=#13 then begin
|
||||
System.Delete(Result,p,2);
|
||||
end;
|
||||
#13:
|
||||
begin
|
||||
// single char line ending #13
|
||||
Result[p]:=#10;
|
||||
end;
|
||||
inc(p);
|
||||
end;
|
||||
inc(p);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user