Page 1 of 1

Numeric Sort in Document Selector

Posted: Tue Jan 20, 2004 6:18 pm
by BenjiSmith
Sometimes I have to open 100 or more documents in the document selector. These documents often have file numbering suffixes, like this:

document1.txt
document2.txt
document3.txt
document4.txt
document5.txt


...or like this...

document.txt_1
document.txt_2
document.txt_3
document.txt_4
document.txt_5


...and sometimes (rarely), they have prefixes, like this...

1_document.txt
2_document.txt
3_document.txt
4_document.txt
5_document.txt


The document selector sorts by ASCII character values, so it starts to fall apart if you have more than 10 documents. They end up getting sorted like this:

document.txt_1
document.txt_10
document.txt_100
document.txt_11
document.txt_12
document.txt_13
document.txt_14
document.txt_15
document.txt_16
document.txt_17
document.txt_18
document.txt_19
document.txt_2
document.txt_20
document.txt_21
document.txt_22
...


Windows XP introduced numeric sorting into the windows explorer, so that the files get displayed in the more sensible numeric order. It would be nice to have something similar in TextPad's document selector, so that a directory full of numbered documents gets sorted numerically.

Posted: Tue Jan 20, 2004 7:13 pm
by s_reynisson
Does this not fall under http://textpad.com/forum/viewtopic.php?t=4216 ?
I.e. a more powerful file selector with Explorer-like attributes.

Edit: there is another poll on the file selector,
http://textpad.com/forum/viewtopic.php?t=4247 ,
maybe we should join all three of them?

Posted: Wed Jan 21, 2004 10:35 am
by ramonsky
Maybe we should have a poll to decide which poll to vote in? :)

Jill

Still - on the topic of this thread, it remains the case that "natural sorting" is not everyone's cup of tea. For a start, it's a platform dependent thing - implemented on WinXP, but not implemented on Win98. Should TP behave like Explorer on the platform on which it's running? Then there's the vexed issue of (ooh er) hexadecimal!. If we're going to use a decimal natural sort, why not a hexadecimal natural sort? Why should File_A not come between File_9 and File_10? (No need for anyone to answer this - I'm not being entirely serious here).

I get round the natural sorting problem by naming my files with leading zeroes, e.g. File_0001, File_0002, etc. Then they sort properly on all platforms all by themselves. This works in hex, too!