linuxmint / nemo

File browser for Cinnamon
GNU General Public License v2.0
1.2k stars 298 forks source link

Fix sorting of files/folders with special characters in the beginning #2085

Closed alexanderdd closed 5 years ago

alexanderdd commented 5 years ago
 * Nemo version (nemo --version) 4.0.6
 * Is issue with desktop or windowed nemo? windowed
 * Distribution - (Mint 17.2, Arch, Fedora 25, etc...) Linux Mint 19.1 Cinnamon
 * Graphics hardware *and* driver used
 * 32 or 64 bit: 64bit

Issue Special characters in the beginning of folder names and files are ignored for sorting.

Steps to reproduce When sorting the following folders alphabetically, the "_" in the beginning is ignored and the next character is used for sorting: Aaron Peter _Sandra

Expected behaviour When sorting the following folders alphabetically, the one with the "_" in the beginning is first. _Sandra Aaron Peter

Other information The only situation where I can think of the current behavior as good is if somebody put the special character in the first posion by accident, in all other use cases the user put the special character there on purpose so ignoring it for sorting is bad UX. Also, the current behavior is counterintuitive for people coming from other linux distros (I used kubuntu and xubuntu before, I think the behavior is differen) or from windows. I think we should strive to welcome those users with their habits.

Maybe also relevant (but not in favor of the proposal there): https://github.com/linuxmint/nemo/issues/1967

roberdaniel commented 5 years ago

I adhere to the request. I can't understand, special characters are ignored intentionally? I clarify that it is not just the initial characters, in any part of the name they are ignored.

roberdaniel commented 5 years ago

I dont know if it is "by design" or is a bug or a kind of missing or the programmer was drunk, but it is inconceivable.

Tyco72 commented 5 years ago

It is absurd that after so many years there is still not the option to sort the file names in the usual way.

bannisdale commented 5 years ago

I totally second the request.

In my old file system, I had a few folders starting with ! so they would be the first one to show up. However, now they're just somewhere in between all the other ones. Which feels ... not right. :-)

Meru commented 5 years ago

would actually be cool to have this... at least as an option that is by default disabled

alexanderdd commented 5 years ago

I disagree. If it becomes a setting, it should be enabled (not disabled) by default. As I have pointed out before, the current setup ignores a deliberate user action, which is bad UX.

Is this behavior inherited from upstream? Should we file a bugreport there, or should we fix it in nemo?

Meru notifications@github.com schrieb am Mi., 24. Apr. 2019 22:59:

would actually be cool to have this... at least as an option that is by default disabled

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/linuxmint/nemo/issues/2085#issuecomment-486423728, or mute the thread https://github.com/notifications/unsubscribe-auth/AG2EN5MPWNUBAOOM363SWI3PSDC3DANCNFSM4G46FCLQ .

smurphos commented 5 years ago

Sorting order Nemo is a function of your locale, different locales can have different conventions. For strict ASCII sorting (which is what I think posters in this thread are after) add export LC_COLLATE=C to your ~/.profile, log off, log back on.

bannisdale commented 5 years ago

@smurphos This seems to work beautifully, thanks a lot! :)

Meru commented 5 years ago

@alexanderdd I agree with you. But I am looking at it from user's perspective, while you - from dev's. From my perspective, any solution is fine, as long as I will be able to make it work the way I want to. But if things should be made right, it should be made the way you suggest.

P.S. haven't looked into locale thingy yet. but even if it works, this solution would not look optimal for such an important thing as filesystem browser and less experienced users won't even know they need to look for this github ticket to figure it out

P.P.S. As a side note, I develop some python apps on windows, mainly and make a heavy use of underscores and exclamation marks and always wondered about this issue since when I open my repo in Mint I have hard time finding the files I need.

Tyco72 commented 5 years ago

@smurphos:

add export LC_COLLATE=C to your ~/.profile, log off, log back on.

I had tried this but it seems to don't work. Does it maybe depend by the distribution? I have Mint 19.1

@bannisdale:

This seems to work beautifully, thanks a lot! :)

Which distro have you?

(Anyway it would be good if there was an option for the sorting in the file manager)

bannisdale commented 5 years ago

Newest Mint, Tessa.

Tyco72 commented 5 years ago

Newest Mint, Tessa.

me too. Could you paste here the part of the .profile file that you edited (or even the whole content)?

bannisdale commented 5 years ago

I basically just copied the line and pasted it below everything else. I'll give you a walkthrough when I'm on my PC again tomorrow.

bannisdale commented 5 years ago

Okay, so.

You should see the following file:

image

As you can see, I already included the line that smurphos mentioned at the bottom of the file.

The result, at least for me, looks like this:

image

Before that, the !downloads folder was sorted below A Test Folder as if it were starting with 'd'.

If this doesn't work for you, I'm afraid that I probably won't be able to provide more information, so sorry in advance. :)

primacore commented 5 years ago

@smurfphos:

For strict ASCII sorting (which is what I think posters in this thread are after) add export LC_COLLATE=C to your ~/.profile, log off, log back on.

This solves sorting of some special characters before letters, but certainly doesn't address Nemo's handling of files starting with numbers. In addition, period and pound-sign still appear after letters. Here's a directory of text files with names starting with all the allowed special characters that should sort before all numbers and letters (ASCII 33-46), some numbers, and some upper/lower-case letters:

user@host:~/sort$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=19.1
DISTRIB_CODENAME=tessa
DISTRIB_DESCRIPTION="Linux Mint 19.1 Tessa"
user@host:~/sort$ cat ~/.profile | grep COLL
export LC_COLLATE=C
user@host:~/sort$ ls -al --group-directories-first
total 8
drwxr-xr-x  2 user user 4096 Apr 26 07:50  .
drwxr-xr-x 60 user user 4096 Apr 26 07:37  ..
-rw-rw-r--  1 user user    0 Apr 26 07:23 '!.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '".txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '#.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '$.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24  %.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24 '&.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 "'.txt"
-rw-rw-r--  1 user user    0 Apr 26 07:24 '(.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 ').txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '*.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24  +.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24  ,.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24  -.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24  .txt
-rw-r--r--  1 user user    0 Apr 26 07:23  1.txt
-rw-r--r--  1 user user    0 Apr 26 07:23  2.txt
-rw-r--r--  1 user user    0 Apr 26 07:23  3.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  A.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  B.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  C.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  a.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  b.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  c.txt

Clearly, changing the locale has fixed the sorting for ls. Meanwhile, nemo seems to have a mind of its own:

sort

Tyco72 commented 5 years ago

Sorry, I see now that it actually worked, but not for the character "_" which I used in my files. I have in many folders files with "_name" to keep them on the top of the list (as well folders), but the setting "LCCOLLATE=C" doesn't affect the If I had used a "!" it would have been better. Now it is quite a trouble to rename all the involved folders and files. Furthermore, as Smurfphos mentions, The problem with the sorting of numbers in Nemo, remains.

primacore commented 5 years ago

DOH! I left underscore out of my list! For both ls using LC_COLLATE=C and Nemo, it slots in between the upper and lower case letters.

Tyco72 commented 5 years ago

Yes right. I wondered why the underscore was not in your list. I though you knew already about it:) But I wonder if I am the only who uses the uderscore "_" to put files and folder on the top of the lint in the file explorer:) It keeps the filename better distinguishable.

roberdaniel commented 5 years ago

Added export LCCOLLATE=C to my .profile but did not work. Nemo still ignores characters like $ - and others... Compare behavior of mc vs nemo

shadow73s commented 5 years ago

I have the same problem with the special chars by sorting.

best_files _download other_files

Before I used the underscore sign to bring the folder on top of the list. Please make a switch in the config, that the special chars are not ignored. Not even user understand the config by editing a mysterious file.

Thanks in advance.

mtwebster commented 5 years ago

File pinning was introduced partly to address this. There are really no plans to further address this issue beyond possible tweaks to that feature.

roberdaniel commented 5 years ago

I'm evaluating to abandon Nemo in favor to Thunar or similar.

roberdaniel commented 5 years ago

It will be Dolphin then, thanks. Midnight commander behave as expected too.

alexanderdd commented 5 years ago

Ignoring deliberate user input is bad UX.

Isn't Linux Mint all about great UX? Then don't close this but fix it.

damian101 notifications@github.com schrieb am Fr., 23. Aug. 2019, 16:03:

@roberdaniel https://github.com/roberdaniel I would use Dolphin, but with Cinnamon there is issue #8584.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/linuxmint/nemo/issues/2085?email_source=notifications&email_token=AG2EN5KOD4KFENJBBDHG72LQF7U47A5CNFSM4G46FCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5AJXQI#issuecomment-524327873, or mute the thread https://github.com/notifications/unsubscribe-auth/AG2EN5KV6WMOAR2SHQ7XBSTQF7U47ANCNFSM4G46FCLQ .

Tyco72 commented 5 years ago

It has not sense to close this issue. It is a very basic feature which many users are waiting to be fixed since years. This and many similar "small issues" are the reason why many users switch back to Windows after fighting with such annoying problems with Linux. "Everything is a workaround" doesn't work for the most of the regular desktop users. The community should listen more to the needs of the users.

mtwebster commented 5 years ago

The original request was to allow a windows hack to work (using special characters to fake out the sort order so you could keep things at the top). I thought, why not provide an actual way to bring important files to the top of the view, without resorting to trickery? So that's exactly what we did with pinning. From my perspective, this is the exact opposite of ignoring user input.

It didn't make sense to change the sort order for everyone from what 99% of users are used to and ok with, for some very small but vocal minority. This is typically what we have to evaluate, and to me it seemed to be a way of accommodating both groups of users.

I've heard all the shaming and threats before, you won't minimize our efforts just because you didn't get precisely what you wanted.

Tyco72 commented 5 years ago

damian101 has right. The question is why it is so difficult just to add an option "sorting mode" in the option menu, where you can select how you want to sort the files in Nemo "universal, natural, numerical, etc...". The pinning function is not the solution. @mtwebster Maybe you refer to the 99% of the Linux users. The 99% of the world-users expect the file sorting working in the standard way, independently of which file manager, or OS you use.

alexanderdd commented 5 years ago

I forgot to mention my use case:

Both in my private life as in my business, I access the same files through Nextcloud. We use both Windows and Linux machines, and sometimes the cloud interface. Nextcloud and Nemo can do favourites/file pinning, but it is not translated to all OS file explorers (and it probably never will).

So the method to bring important files/folders to attention for all users is to use a leading underscore. Windows respects it, Nextcloud webinterface respects it, Linux Mint/Nemo doesn't.

Maybe some others have the same use case?

Tyco72 notifications@github.com schrieb am So., 25. Aug. 2019, 12:09:

damian101 has right. The question is why it is to difficult just to add an option "sorting mode" in the option menu, where you can select how you want to sort the files in Nemo "universal, natural, numerical, etc...". The pinning function is not the solution. @mtwebster https://github.com/mtwebster Maybe you refer to the 99% of the Linux users. The 99% of the world-users expect the file sorting working in the standard way, independently of which file manager, or OS you use.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/linuxmint/nemo/issues/2085?email_source=notifications&email_token=AG2EN5P7UMS3XSTAVLNNGPTQGJK3ZA5CNFSM4G46FCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5CQOIY#issuecomment-524617507, or mute the thread https://github.com/notifications/unsubscribe-auth/AG2EN5JCWXBGT3THQ65E34LQGJK3ZANCNFSM4G46FCLQ .

bannisdale commented 5 years ago

@alexanderdd It's somewhat similar for me. I use both Windows and Linux on the same machine. Some of the files and folders are also shared within my family. Only Linux is running into the issue that the Folder "_Important Files" shows up in between the folders "Arbitrary Files" and "More Files". ;-)

I personally would prefer all OSs sorting the files the same way, but given that the opinions differ, it's probably the best way to go with a sorting option in the settings.

shadow73s commented 5 years ago

It didn't make sense to change the sort order for everyone from what 99% of users are used to and ok with, for some very small but vocal minority. This is typically what we have to evaluate, and to me it seemed to be a way of accommodating both groups of users.

I argue, that 99% of these 99% have 2 reasons why you don't hear from them.

  1. They don't know, that this possibility exists to bring suggestions.

  2. They don't care, because the don't know, that the "_" can make there life easier.

roberdaniel commented 5 years ago

I would like to add that Midnight Commander uses the expected sorting with special characters at the top as commented early in this ticket.

j1warren commented 4 years ago

Also would like this to be implemented.

Y0Mamma commented 4 years ago

Linux user for 3 years now, programmer for 30+ years before that. Mint is an awesome distro and my choice after evaluating 30+ distros. That being said, it is frustrating to encounter things like this that will never be fixed. I know that resources are finite and that this is not an issue that is specific to Linux distro developers, as I have encountered the same things from Linux software developers in general. Filezilla is a prime example. I guess what I am trying to say is that I feel like I understand both sides of issues like this. Maybe when I win the Powerball I can fund the Mint team to take on issues like this. :-)

alexanderdd commented 4 years ago

Maybe this is the wrong place to discuss this, because the issue is upstream? Can someone point me to the relevant upstream project? Is it "ls" commmand? And maybe to the correponding issue (cause I bet we are not the first people to bring this up)?

But then dolphin and midnight commander has it, so it can be fixed downstream...

But mint devs have said above that this will not be fixed, and the issue is closed already, so unless someone has the ability to make a pull request, we are stuck with weird sorting for ever.

alexanderdd commented 4 years ago

I thought maybe the current behavior has its roots in how the ls command (or something else really basic) works, which is the same in all linux distros.

But that is probably even harder than trying to convince Mint Devs about fixing sort order.

damian101 <http://notifications@github.com > hat am February 14, 2020 um 11:06 AM geschrieben:

@alexanderdd https://github.com/alexanderdd I guess an upstream "fix" would have to made for every base distribution individually and Ubuntu/Mint users aren't the only ones who enjoy the Nemo file manager.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/linuxmint/nemo/issues/2085?email_source=notifications&email_token=AG2EN5KVPEGZ3VLNOS2R24TRCZULNA5CNFSM4G46FCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELYI4JQ#issuecomment-586190374 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AG2EN5PJWB3TQAZCLXTJ6O3RCZULNANCNFSM4G46FCLQ .
skramm commented 3 years ago

Just found this issue and dropped in here to say that there should really be an option to enable sorting in a similar way as other file explorers. I think that @mtwebster might (?) not have understood: this request is NOT about changing the default sort order, that (maybe?) most users are happy with. This is only about adding some option so that Nemo (that I use for years) can have a behavior consistent with the other file explorers. This is crucial in a multi-OS shared filed environment, as @bannisdale and @alexanderdd pointed out.

And, talking about consistency, I agree that Nemo mimics the behavior of ls -l (or maybe it even uses it as backend?), but does that mean that this is the best way to go ? Personaly, I don't think so, I believe sorting should be possible using plain ASCII-table ordering (but I agree that this can be disputed). And that this should be possible using some Nemo options, not using some locale change in profile.

My 2 cents, hope this gets fixed one day...

bwakkie commented 2 years ago

export LC_COLLATE=C didn't do the trick. ls -l does sort the the following order: (special char) (0-9) (a-z case insensitive!)

For uuid's sort see #2847 which has a different(?) problem

taunnt commented 1 year ago

Hello, export LC_COLLATE=C worked for me on Ubuntu 22.04 Nemo 5.2.4. Only issue is the case. Capital letters are on the top then lower case are under them. Anyway to mod export LC_COLLATE=C where charters are on top, but it ignores the case upper/lower?

nilslindemann commented 1 year ago

Meanwhile, on Linux Mint 21 this seems to work, e.g. both export LC_COLLATE=C and my preferred export LC_ALL=C.UTF-8 respects punctuation., when put into .profile. (Computer needs to be restarted)

nazar-pc commented 4 months ago

Wow, I really hope it is possible to get ASCII sorting somehow. With both files starting with . and cyrillic characters nothing works properly.

With my current locale I get cyrillic>latin>dot and with LC_ALL=C.UTF-8 I get latin>cyrillic>dot. What I actually want is what SpaceFM does: dot>latin>cyrillic.

edswangren commented 1 week ago

I also support a sorting method for humans, by devs, with consistency and simplicity for all (platforms)