Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

"Sort files alphabitically" is case-sensitive :-(

16 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I updated my Lazarus to the latest Trunk revision. I see there is now a "sort files alphabetically" option in the Project Inspector.

Unfortunately the sorting seems to be case-sensitive. So units with capital letters appear before units with lowercase letters. Was this done by design, or simply an oversight?

See attached image for an example of what I mean.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net -------------- next part -------------- A non-text attachment was scrubbed... Name: screenshot.png Type: image/png Size: 11630 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111114/fcb8ce88/attachment.png>

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 8 lines
Hi, I updated my Lazarus to the latest Trunk revision. I see there is now a "sort files alphabetically" option in the Project Inspector. Unfortunately the sorting seems to be case-sensitive. So units with capital letters appear before units with lowercase letters. Was this done by design, or simply an oversight?

Design.
It sorts file names, so case sensitive under Linux and case insensitive under Windows and OS X.

See attached image for an example of what I mean.

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote
Design. It sorts file names, so case sensitive under Linux and case insensitive under Windows and OS X.

Would you mind if I supply a patch to make case sensitivity optional? Nautilus has such an option too. So do other Linux file managers. If not, no problems, I'll add it to my list of home-grown patches I apply to each checkout.

PS:
OS X is not always case insensitive, you can format a filesystem with case sensitivity enabled too. Just thought I would mention this.

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 10 lines
On 14/11/2011, Mattias Gaertner <nc-gaertnma at ...> wrote: > > Design. > It sorts file names, so case sensitive under Linux and case > insensitive under Windows and OS X. Would you mind if I supply a patch to make case sensitivity optional? Nautilus has such an option too. So do other Linux file managers. If not, no problems, I'll add it to my list of home-grown patches I apply to each checkout.

I don't mind, if you think broad minded.
Some users might want to sort first for file type
and then alphabetically, or to reverse. Maybe the
Sort button should popup a menu with of a few common orders. Or it opens a small dialog. Whatever you prefer.

PS: OS X is not always case insensitive, you can format a filesystem with case sensitivity enabled too. Just thought I would mention this.

Same for Linux.
But checking via Kernel functions is a magnitude slower and so far there were no big complains.

Mattias

Reply by email

Hans-Peter Diettrich
to Mattias Gaertner: On Mon, 14 Nov 2011 15:56:00 +0200 Design. It sorts file names, so case sensitive under…
Show quoted text 15 lines
On Mon, 14 Nov 2011 15:56:00 +0200 Graeme Geldenhuys wrote: > Hi, > > I updated my Lazarus to the latest Trunk revision. I see there is now > a "sort files alphabetically" option in the Project Inspector. > > Unfortunately the sorting seems to be case-sensitive. So units with > capital letters appear before units with lowercase letters. Was this > done by design, or simply an oversight? Design. It sorts file names, so case sensitive under Linux and case insensitive under Windows and OS X.

IMO a project contains *units* in the first place, and unit names are case insensitive. It's not allowed to add a unit twice, with only different filename case.

Consequently project file sorting should be case insensitive, unique across platforms.

DoDi

Reply by email

Sven Barth
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 22 lines
Mattias Gaertner schrieb: > On Mon, 14 Nov 2011 15:56:00 +0200 > Graeme Geldenhuys wrote: > >> Hi, >> >> I updated my Lazarus to the latest Trunk revision. I see there is now >> a "sort files alphabetically" option in the Project Inspector. >> >> Unfortunately the sorting seems to be case-sensitive. So units with >> capital letters appear before units with lowercase letters. Was this >> done by design, or simply an oversight? > > Design. It sorts file names, so case sensitive under Linux and case > insensitive under Windows and OS X. IMO a project contains *units* in the first place, and unit names are case insensitive. It's not allowed to add a unit twice, with only different filename case. Consequently project file sorting should be case insensitive, unique across platforms.

But the project inspector does contain the *file* names and not the *unit* names. And these *can* be different (not only in casing), though I personally don't know anyone who uses the "-Un" option which is necessary for this...

Regards,
Sven

Reply by email

Graeme Geldenhuys
to Hans-Peter Diettrich: IMO a project contains *units* in the first place, and unit names are case insensitive.…
Hans-Peter Diettrich wrote
Consequently project file sorting should be case insensitive, unique across platforms.

+1
But if we can't do that (which seems to be the case), then at least I want to add an option no enable case-insensitive sorting. Normally my units are all lower-case, but I have some legacy units which came from some old Delphi projects which use uppercase letters - thus causing the crappy sorting in my project.

Anyway, adding the option should be easy - so my problem should be sorted in no time (excuse the pun). :-)

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Hans-Peter Diettrich
to Sven Barth: But the project inspector does contain the *file* names and not the *unit* names. And…
Show quoted text 7 lines
> Consequently project file sorting should be case insensitive, unique > across platforms. But the project inspector does contain the *file* names and not the *unit* names. And these *can* be different (not only in casing), though I personally don't know anyone who uses the "-Un" option which is necessary for this...

Just in case the same filenames with different casing have been added to a project, it's important to see all these versions together, and not spread across the entire list.

Summary: the case sensitivity of a file system does not imply any specific sort order. The same for the sort order in different applications (file browsers...). The *display* of a file list has to be optimized for *human* reading, i.e. case insensitive unless there exists a special important meaning of upper/lower case names.

DoDi

Reply by email

Jürgen Hestermann
to Hans-Peter Diettrich
Summary: the case sensitivity of a file system does not imply any specific sort order.

Exactly. The question is: What is the purpose of sorting? Isn't it for easier finding list entries? Then it would be even better to sort case insensitive on Linux too. It would also show files that differ in case only as adjacent entries which may be an important information.

Reply by email

Sven Barth
to Hans-Peter Diettrich: Just in case the same filenames with different casing have been added to a project, it's…
Hans-Peter Diettrich wrote 19 lines
Sven Barth schrieb: >> Consequently project file sorting should be case insensitive, unique >> across platforms. > > But the project inspector does contain the *file* names and not the > *unit* names. And these *can* be different (not only in casing), > though I personally don't know anyone who uses the "-Un" option which > is necessary for this... Just in case the same filenames with different casing have been added to a project, it's important to see all these versions together, and not spread across the entire list. Summary: the case sensitivity of a file system does not imply any specific sort order. The same for the sort order in different applications (file browsers...). The *display* of a file list has to be optimized for *human* reading, i.e. case insensitive unless there exists a special important meaning of upper/lower case names.

In the end it's a taste of the individual if he or she wants to have units sorted case sensitive or not. Thus it is a good idea to make this configurable as Graeme suggested. So in the end everyone can be happy.

Note: I myself prefer case insensitive sorting as well

Regards,
Sven

Reply by email

Graeme Geldenhuys
to Sven Barth
Sven Barth wrote
Note: I myself prefer case insensitive sorting as well

So Mattias stands alone then. :-)

This makes we wonder if Mattias shouldn't rethink his decision? Clearly most developers want case insensitive sorting in this case - simply because units to the compiler are case insensitive anyway.

Mattias?
I don't mind implementing alternative options, but it seems like a waist of effort, if everybody is going to pick "case insensitive sorting" anyway - irrespective of the platform being used.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 14 lines
On 15/11/2011, Sven Barth wrote: > > Note: I myself prefer case insensitive sorting as well So Mattias stands alone then. :-) This makes we wonder if Mattias shouldn't rethink his decision? Clearly most developers want case insensitive sorting in this case - simply because units to the compiler are case insensitive anyway. Mattias? I don't mind implementing alternative options, but it seems like a waist of effort, if everybody is going to pick "case insensitive sorting" anyway - irrespective of the platform being used.

You misunderstood me.
You asked if it was a bug or by design. It's not a bug to sort a list of files using the CompareFilenames function. It would be a bug if it would sort via CompareText or AnsiCompareText, because of the OS X normalization.
Of course you often need another sorting and people prefer different defaults. That's why I planned to add a few sort orders and store the options in the project session, so everyone can choose their preference. I simply had not yet the time to implement it. That's why I kindly asked if you may want to help there. Once a few sort orders are implemented, I agree that the default can be case insensitive. IMO it would be a bug under Linux if the files can not be sorted case sensitive.
If you don't have the time, please create a feature request and assign it to me.

Mattias

Reply by email

Michael Schnell
to Mattias Gaertner: On Mon, 14 Nov 2011 19:20:47 +0200 I don't mind, if you think broad minded. Some users…
Mattias Gaertner wrote
> OS X is not always case insensitive, you can format a filesystem with > case sensitivity enabled too. Just thought I would mention this. Same for Linux.

???

I understand that DOS is handled as case insensitive (and supposedly NTFS, too), but other file systems ? I did not yet see a file system that provides case (in)sensitivity as an option.

-Michael

Reply by email

Sven Barth
to Michael Schnell
Michael Schnell wrote 10 lines
On 11/14/2011 06:42 PM, Mattias Gaertner wrote: > >> OS X is not always case insensitive, you can format a filesystem with >> case sensitivity enabled too. Just thought I would mention this. > Same for Linux. ??? I understand that DOS is handled as case insensitive (and supposedly NTFS, too), but other file systems ? I did not yet see a file system that provides case (in)sensitivity as an option.

NTFS is one. The filesystem itself is case sensitive, but Windows treats it as case insensitive (using the Interix POSIX subsystem one can even create files that differ only in casing and are correctly displayed by the Explorer).

Regards,
Sven

Reply by email

Graeme Geldenhuys
to Mattias Gaertner: On Tue, 15 Nov 2011 11:43:11 +0200 You misunderstood me. You asked if it was a bug or by…
Mattias Gaertner wrote
You misunderstood me.

Indeed. :)

preference. I simply had not yet the time to implement it. That's why I kindly asked if you may want to help there.

No problem, I'll take a look.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email