|
@@ -4194,6 +4194,7 @@ var
|
|
SectionLength, NestingLevel, Index: Integer;
|
|
SectionLength, NestingLevel, Index: Integer;
|
|
{$ifdef UsePChar}
|
|
{$ifdef UsePChar}
|
|
OldLength: integer;
|
|
OldLength: integer;
|
|
|
|
+ Ch: Char;
|
|
{$else}
|
|
{$else}
|
|
s: string;
|
|
s: string;
|
|
l: integer;
|
|
l: integer;
|
|
@@ -4346,13 +4347,19 @@ begin
|
|
begin
|
|
begin
|
|
SectionLength:=FTokenPos - TokenStart;
|
|
SectionLength:=FTokenPos - TokenStart;
|
|
{$ifdef UsePChar}
|
|
{$ifdef UsePChar}
|
|
- SetLength(FCurTokenString, OldLength + SectionLength+1); // +1 for #10
|
|
|
|
|
|
+ SetLength(FCurTokenString, OldLength + SectionLength + length(LineEnding)); // Corrected JC
|
|
if SectionLength > 0 then
|
|
if SectionLength > 0 then
|
|
- Move(TokenStart^, FCurTokenString[OldLength + 1], SectionLength);
|
|
|
|
- Inc(OldLength, SectionLength+1);
|
|
|
|
- FCurTokenString[OldLength] := #10;
|
|
|
|
|
|
+ Move(TokenStart^, FCurTokenString[OldLength + 1],SectionLength);
|
|
|
|
+
|
|
|
|
+ // Corrected JC: Append the correct lineending
|
|
|
|
+ Inc(OldLength, SectionLength);
|
|
|
|
+ for Ch in LineEnding do
|
|
|
|
+ begin
|
|
|
|
+ Inc(OldLength);
|
|
|
|
+ FCurTokenString[OldLength] := Ch;
|
|
|
|
+ end;
|
|
{$else}
|
|
{$else}
|
|
- FCurTokenString:=FCurTokenString+copy(FCurLine,TokenStart,SectionLength)+#10;
|
|
|
|
|
|
+ FCurTokenString:=FCurTokenString+copy(FCurLine,TokenStart,SectionLength)+LineEnding; // Corrected JC
|
|
{$endif}
|
|
{$endif}
|
|
if not FetchLocalLine then
|
|
if not FetchLocalLine then
|
|
begin
|
|
begin
|
|
@@ -4656,13 +4663,19 @@ begin
|
|
begin
|
|
begin
|
|
SectionLength := FTokenPos - TokenStart;
|
|
SectionLength := FTokenPos - TokenStart;
|
|
{$ifdef UsePChar}
|
|
{$ifdef UsePChar}
|
|
- SetLength(FCurTokenString, OldLength + SectionLength+1); // +1 for the #10
|
|
|
|
|
|
+ SetLength(FCurTokenString, OldLength + SectionLength + length(LineEnding)); // Corrected JC
|
|
if SectionLength > 0 then
|
|
if SectionLength > 0 then
|
|
Move(TokenStart^, FCurTokenString[OldLength + 1],SectionLength);
|
|
Move(TokenStart^, FCurTokenString[OldLength + 1],SectionLength);
|
|
- Inc(OldLength, SectionLength+1);
|
|
|
|
- FCurTokenString[OldLength] := #10;
|
|
|
|
|
|
+
|
|
|
|
+ // Corrected JC: Append the correct lineending
|
|
|
|
+ Inc(OldLength, SectionLength);
|
|
|
|
+ for Ch in LineEnding do
|
|
|
|
+ begin
|
|
|
|
+ Inc(OldLength);
|
|
|
|
+ FCurTokenString[OldLength] := Ch;
|
|
|
|
+ end;
|
|
{$else}
|
|
{$else}
|
|
- FCurTokenString:=FCurTokenString+copy(FCurLine,TokenStart,SectionLength)+#10;
|
|
|
|
|
|
+ FCurTokenString:=FCurTokenString+copy(FCurLine,TokenStart,SectionLength)+LineEnding; // Corrected JC
|
|
{$endif}
|
|
{$endif}
|
|
if not FetchLocalLine then
|
|
if not FetchLocalLine then
|
|
begin
|
|
begin
|