#121 Incorrect line endings for newer versions of Mac OS

v1.0_(example)
closed-fixed
nobody
None
5
2015-04-08
2012-11-28
Anonymous
No

In 'src/codegen/codewriter.cpp' line endings that the codewriter is using are set according to the operating system.
When Mac OS is detected the line endings are set to \r, which is not correct anymore for newer versions of Mac OS.
Mac OS used to be using CR(\r) as line ending but more recent versions (OS X) are using linefeeds(\n) for new lines.

The outputted code by wxFormBuilder is therefor not displayed correctly in other editors or mergetools which makes the code output difficult to work with in OSX.

Discussion

  • Ariën Tolner

    Ariën Tolner - 2012-11-28

    This post was created by me. Sorry for not loging in first.

     
  • Nikita Schmidt

    Nikita Schmidt - 2014-02-15

    Just ran version 3.3.4-beta, the problem is present and severe.
    The generated code is unusable.
    I doubt anybody wants to run wxFormBuilder on Macs that are so ancient that they still use \r line endings. It probably won't even compile for them.
    It is therefore perfectly safe to change line endings to \n when running on a Mac.

     
  • Rocrail

    Rocrail - 2014-06-25

    This bug is almost open for 2 years by now. ;)
    Please fix it or make it configurable.
    The mac2unix utility has earn some holidays. :)

     
  • Rocrail

    Rocrail - 2014-06-25

    Just remove the WXMAC section from this function found in codewriter.cpp:

    void CodeWriter::WriteLn( wxString code, bool keepIndents )
    {
    // It will not be allowed newlines (carry return) inside "code"
    // If there was anyone, then FixWrite gets the string and breaks it
    // in different lines, inserting them one after another using WriteLn
    if ( !StringOk( code ) )
    {
    FixWrite( code, keepIndents);
    }
    else
    {
    if(keepIndents)
    {
    m_cols = m_indent;
    }

        Write( code );
        #if defined( __WXMSW__ )
            Write( wxT("\r\n") );
        #elif defined( __WXMAC__ )
            Write( wxT("\r") );
        #else
            Write( wxT("\n") );
        #endif
        m_cols = 0;
    }
    

    }

     
  • Michal Bližňák

    Fixed in wxFB 3.5.1-RC1.

     
  • Michal Bližňák

    • status: open --> open-fixed
    • Group: --> v1.0_(example)
     
  • Michal Bližňák

    • status: open-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks