Community
    • Login

    Bug in sorting lines, staying there for years

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 4 Posters 42 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Eric WisemanE
      Eric Wiseman
      last edited by

      Line Operations -> Sort lines works ONLY if you convert Edit -> EOL Conversion ->Unix.

      Unless I am missing something this looks like a bug…

      PeterJonesP CoisesC 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Eric Wiseman
        last edited by PeterJones

        @Eric-Wiseman said in Bug in sorting lines, staying there for years:

        Line Operations -> Sort lines works ONLY if you convert Edit -> EOL Conversion ->Unix.

        Unless I am missing something this looks like a bug…

        Correction: Edit > Line Operations > Sort … commands work ONLY if you have consistent EOL, whether it is consistently Unix (LF), consistently Mac (CR), or consistently Windows (CRLF). There are multiple Issues in the official issue repository for this (the most recent of which is #17251).

        You can try the experiment yourself: do the Edit > EOL Conversion to Unix, then back to Windows CRLF, and you will see that you can still sort correctly, so it’s obviously not anything unique about the Unix line ending.

        And if you look at the original version of your file where sort didn’t work right away, and use View > Show Symbol > Show End of Line, you will see that one of more of the lines that didn’t sort correctly have a different line ending than the one shown in the status bar (like the image @mpheath posted in this comment on issue #17251)

        Mismatched line endings are evil, and if you have some other application that is creating a file that has them, it needs to be reported to the maker of that software as a bug. And until that end of the process is fixed, you can use Notepad++ to convert the EOL twice (once to something other than Windows EOL, then a second time to get back to Windows EOL) to get consistent line endings.

        1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn
          last edited by

          @PeterJones said in Bug in sorting lines, staying there for years:

          #17251

          MY favorite issue for this one…stuck in my brain somehow…is https://github.com/notepad-plus-plus/notepad-plus-plus/issues/7735

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Alan Kilborn
            last edited by

            @Alan-Kilborn said in Bug in sorting lines, staying there for years:

            MY favorite issue for this one

            Good memory. I like that one, because it’s got so many links to/from the other issues (I just linked the newest back to that one as well), as well as having links to the various discussions in this Forum where users have problems with it. Thus, it makes a good “table of contents” for the various discussions.

            1 Reply Last reply Reply Quote 0
            • CoisesC
              Coises @Eric Wiseman
              last edited by Coises

              @Eric-Wiseman said in Bug in sorting lines, staying there for years:

              Line Operations -> Sort lines works ONLY if you convert Edit -> EOL Conversion ->Unix.

              Unless I am missing something this looks like a bug…

              As others have already explained, this is not a bug but rather a known and documented limitation, that all line endings must be the same.

              If Sort Lines In Locale Order Ascending and Descending do what you want, those sorts implemented differently and are not dependent on consistent line endings. The ending for each line will remain with the text of the line it follows.

              The Locale sorts can also sort using a rectangular selection for the keys even if there are tabs or characters of differing byte widths (such as can happen with non-ASCII characters in UTF-8) to the left of the selection, which does not work with the other sorts.

              1 Reply Last reply Reply Quote 2
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors