Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to simulate an improved sort with sort criterias !

  • Fool4UAnyway
    Fool4UAnyway
    2013-12-31

    Now, let suppose that, if you type in a tabulation
    it takes FOUR spaces ( the default N++ number of spaces ).
    Then, with the simple S/R, in Extended or Regular
    expression mode, ( \t --> FOUR spaces ),
    the sort should be correct :-)

    Of course, the second S/R may break position
    of text in your file , because your file may
    mix spaces and tabulations, anywhere, in the
    same line :(>

    No, the big problem is that not all tabs represent the maximum number of 4 spaces or any other number.

    If a line starts with any number of space characters up to 1 less than the tab size and then has a tab character, the tab character should be replaces by 1 up to tab size minus 1 additional space characters.

    Yes, then, to undo this, you have an additional problem because you don't know the Original order of tab and space characters, but hey, since you started to replace all tab characters with the maximum number of space characters, you made a mess of it anyway...

    You simply do not want users to have to do this in order to get a good position (...).
    Notepad++'s sorting algorithm should take the "width" or virtual positions of tab characters into account when sorting (by internally replacing them by space characters first) and then later perform an additional search criterion and ordering by the actual character on the matching position (tab x09 < space x20) and skipping all positions from there up until the next matching like the tab character does in the text view.