Community
    • Login

    Line sorting not working in some cases

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 3 Posters 351 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.
    • niente0N
      niente0
      last edited by

      Hi all,
      the problem I have is that if I try to sort lines separated by just \n (instead of \r\n), Notepad++ doesn’t sort them because it sees them like a single block.

      In my opinion lines separated by just \n should be considered independent lines. Do you agree? Is it a bug?

      Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @niente0
        last edited by Alan Kilborn

        @niente0

        Nope, no bug.

        It breaks the lines according to what your status bar says the line endings are.
        Example of that:
        0f8e8379-106c-4bd3-9a69-01062f17da8c-image.png

        If you mix line ending types in your file, this is a bad thing that you shouldn’t do. And yes, if that’s the case it will not sort like you want it to.

        The cure is to convert line endings to a different type than you want, then convert back to the type you do want. Then you are safe to proceed with your sort. See Edit menu > EOL Conversion

        1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones @niente0
          last edited by

          @niente0 ,

          FYI, the next release of the npp-user-manual.org (which will go live after Notepad++ v7.9.6 releases) will include an extra description on the line-sorting features, making what @Alan-Kilborn more obvious to those who actually look at the usermanual:

          NOTE: Sorting is performed with the assumption that all line-endings in the file are uniform and match the current selection for the file being edited – the quickest way to check that selection is to glance at the status bar, where the current line-ending type is shown either as Windows (CR LF), Unix (LF) or Macintosh (CR). It might be desirable to check the line-ending types in your file before executing a sorting operation.

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

            @PeterJones

            Cool that that kind of thing made it into the manual.
            Manual is getting better and better all the time.

            Does it go far enough, though?
            Maybe it should also say what I said, how to convert the lines.

            Nah, it’s OK, that would be redundant documenting because I’m sure there is also an independent place where EOL conversion is discussed.

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

              @Alan-Kilborn ,

              Maybe it should also say what I said, how to convert the lines.

              https://github.com/notepad-plus-plus/npp-usermanual/pull/219

              So the sort and duplicates EOL paragraphs now direct you to read EOL Conversion to find out how to do the fix, and the EOL Conversion paragraph mentions converting once or twice to fix the mixed-eol situation.

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