Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2023-12

AdjustLineBreaks: fixed in trunk, broken in fixes_3_2 (?)

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

Just noticed that AdjustLineBreaks is broken if the Style parameter is set to tlbsCR. (Tested with 3.2.2).
In fpc main this is fixed, in fixes_3_2 this still seems broken.

The fix in main was committed in 1c4151d8 (1 merge reques t!396 Fix, shorten*, and speed up AdjustLineBreaks.( MR by Rika)) In the MR Rika comments: "presently, AdjustLineBreaks might just not work, because it attempts to optimize the case of unchanged string by looking only if the length has changed, which does not account for possible changing lone #13 to #10."
It does not mention that (before the fix)
AdjustLineBreak(SomeStringWithCRLF, tlbsCR) changed the linebreaks to LineFeed instead of CarriageReturn.

I would request that the changes from commit 1c4151d8 are merged to fixes_3_2.

For completeness I attached a sample program demonstrating the error. Run with commandlineparameter --3.2.2 to see 3.2.2 behaviour Run with commandlineparameter --fixes to see fixes_3_2 behaviour Run with commandlineparameter --trunk to see fpc main (with commit 1c4151d8) behaviour
Run without commandline parameter to get the default behaviour of your current compiler.

For both 3.2.2 and fixes code it outputs:

LF: OK: one[LF]two[LF]three

CR: Fail
Expected: one[CR]two[CR]three
Got : one[LF]two[LF]three

CRLF: OK: one[CR][LF]two[CR][LF]three

LF to CR: Fail
Expected: one[CR]two[CR]three
Got : one[LF]two[LF]three

LF->CR->CRLF: OK: one[CR][LF]two[CR][LF]three

CRLF->LF->CR: Fail
Expected: one[CR]two[CR]three
Got : one[LF]two[LF]three

The code for main outputs:
LF: OK: one[LF]two[LF]three

CR: OK: one[CR]two[CR]three

CRLF: OK: one[CR][LF]two[CR][LF]three

LF to CR: OK: one[CR]two[CR]three

LF->CR->CRLF: OK: one[CR][LF]two[CR][LF]three

CRLF->LF->CR: OK: one[CR]two[CR]three

Bart

Reply by email

Marco van de Voort
to Bart

Op 17-12-2023 om 17:27 schreef Bart via fpc-devel:

I would request that the changes from commit 1c4151d8 are merged to fixes_3_2.

I'm currently trying to make a dent in the merging backlog that the transition to git made.

I'm trying to merge as much as possible in order, and this one still doesn't merge cleanly, so it will have to wait till I'm a further in the merge process.

If it is not merged a week from now, remind me again.

Reply by email

Marco van de Voort
to Marco van de Voort

Op 17-12-2023 om 17:49 schreef Marco van de Voort via fpc-devel:

Show quoted text 12 lines
Op 17-12-2023 om 17:27 schreef Bart via fpc-devel: >   I would request that the changes from commit 1c4151d8 are merged to > fixes_3_2. I'm currently trying to make a dent in the merging backlog that the transition to git made. I'm trying to merge as much as possible in order, and this one still doesn't merge cleanly, so it will have to wait till I'm a further in the merge process.

Never mind, it is merged. The road blocks turned out to be  in the dotted RTL related revisions (since it is a pchar based routine), so in the end I manually merged.

Reply by email