Menu

#366 Multiple formatting of the same file leads to different results, if WrapLongLines (100 Lines) is actived

Closed
closed-fixed
None
5
2024-12-16
2024-02-20
pustekuchen
No

Example

unit Unit1;

interface

type
TSampleClass = class(TObject)
procedure thisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213(); virtual;
end;

implementation

end.

Formatted once:

procedure thisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213();
  virtual;

Formattet twice

procedure thisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213();
virtual;

I would expect the same result, if the file gets formatted multiple times. (Use Case: automatic calling the formatter before commiting files or calling in a pipeline job)

Discussion

  • Thomas Mueller

    Thomas Mueller - 2024-02-20

    I just tried this and it works as expected. Maybe there are other formatter settings involved? Please export your formatter settings to an INI file and attach it to this bug report. This can be done using the "Tools >" button in the formatter's configuration dialog.

     
  • pustekuchen

    pustekuchen - 2024-02-21
    [settings]
    SpaceOperators=3
    SpaceColon=2
    SpaceSemiColon=2
    SpaceComma=2
    SpaceLeftBr=0
    SpaceRightBr=0
    SpaceLeftHook=0
    SpaceRightHook=0
    SpaceEqualOper=3
    UpperCompDirectives=1
    UpperNumbers=1
    ReservedCase=0
    StandDirectivesCase=0
    IdentifiersCase=3
    ChangeIndent=1
    NoIndentElseIf=0
    NoIndentVarDecl=1
    NoIndentUsesComma=0
    IndentBegin=0
    IndentTry=1
    IndentTryElse=0
    IndentCaseElse=0
    IndentComments=1
    IndentCompDirectives=1
    BlankProc=1
    BlankSubProc=0
    RemoveDoubleBlank=1
    SpacePerIndent=2
    FeedRoundBegin=2
    FeedRoundTry=2
    FeedBeforeElse=1
    FeedBeforeEnd=1
    FeedAfterThen=1
    ExceptSingle=0
    FeedAfterUses=1
    FeedAfterVar=1
    FeedEachUnit=0
    NoFeedBeforeThen=1
    FeedEachUnitBeforeComma=0
    FeedElseIf=0
    FillNewWords=2
    FeedAfterSemiColon=1
    StartCommentOut={(*}
    EndCommentOut={*)}
    WrapLines=1
    WrapPosition=100
    AlignCommentPos=45
    AlignComments=1
    AlignVarPos=20
    AlignVar=0
    Precedence1=0
    Precedence2=1
    Precedence3=2
    CapitalizationFile=CodeFormatterCapitalization.txt
    
     
  • pustekuchen

    pustekuchen - 2024-02-21

    Here is the current configuration and an gif which shows the behavior

    Im using Version 1.3.22 Build 4008

     

    Last edit: pustekuchen 2024-02-21
  • Thomas Mueller

    Thomas Mueller - 2024-02-21

    Thanks.
    After importing your configuration I can reproduce the bug, so there was some other setting involved. Unfortunately your configuration differ greatly from mine which makes it difficult to find which particular combination of settings causes the problem.

     
  • Thomas Mueller

    Thomas Mueller - 2024-02-21

    It also happens with this simple procedure declaration:

    procedure vverylongthisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213(); cdecl;
    

    no class required.

     

    Last edit: Thomas Mueller 2024-02-21
  • Thomas Mueller

    Thomas Mueller - 2024-02-21

    It's possibly related to the problem with multi line function directives (2 existing test cases in unit tests which currently fail). But these also fail with my own configuration.

     
  • Thomas Mueller

    Thomas Mueller - 2024-02-23

    I was mistaken: Regardless of which other settings are active, I can now reproduce it simply by formatting:

    procedure vverylongthisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213();
       cdecl;
    

    and see the spaces in front of cdecl disappear.

    The Wrap log lines setting is only necessary to produce this line from one where the function directive is located after the function declaration.

     

    Last edit: Thomas Mueller 2024-02-23
  • Thomas Mueller

    Thomas Mueller - 2024-02-23

    added test case for unit tests in revision #4216

     
  • Thomas Mueller

    Thomas Mueller - 2024-02-24
    • status: open --> closed-fixed
    • assigned_to: Thomas Mueller
    • Group: New --> Closed
     
  • Thomas Mueller

    Thomas Mueller - 2024-02-24

    Fixed in revision #4219

     
  • pustekuchen

    pustekuchen - 2024-12-16

    Version 1.3.25 build 4298
    Problem still exists. After run the formatter twice, spaces are removed in the 2nd line.

        function ReadIntegerFromRegistry(const PathKey: string; const Key: string; var Value: Integer):
          Boolean;
    
        function ReadIntegerFromRegistry(const PathKey: string; const Key: string; var Value: Integer):
        Boolean;
    
     

    Last edit: pustekuchen 2024-12-16

Log in to post a comment.

Monday.com Logo