Below is exactly how Geany is sorting these document names with underscore chars. Same problem when changing underscore to dashes. VERY awkward when trying to group related source code documents in the left panel.
show_area_c.php show_area_cc.php show_area_cc_rs.php show_area_c_rs.php
To answer the question, filenames are sorted in accordance with the unicode locale collation rules not code point order, the same as most file managers. For the rules see [here](https://unicode.org/reports/tr10/) which is likely to do strange things with punctuation characters.
Closed #2967.
tks. The Geany file browser plugin DOES sort properly. Any way to get the default Geany document browser in left panel to sort properly for underscores or dashes? modify unicode settings, etc?
The file browser plugin does its own thing, which is to convert to lower case and then sort by Unicode code point value. That is ok for ASCII based locales, but less so for non-ascii where the Unicode collation is more appropriate eg sorting ñ between n and o in Spanish.
The collation ordering is performed by system library code, not Geany code. It is supposed to follow the Unicode standard I linked above, so I suspect its not modifiable.
guess i will have to do something awkward to keep these associated php files grouped clearly, like separate groups of php files in sibling directories on disk go Geany document browser will at least appear to sort them properly. seems like an extreme workaround. tks
On second thought, i don't think this is due to char value sorting at all. below is how the doc browser is sorting. The two filenames with "_c_" should be next to each other, as they DO show in the plugin file browser, likes values next to like values, regardless of any character set char values for a 'c' versus an underscore.
show_area_c_.php show_area_cc.php show_area_cc_rs.php show_area_c_rs.php
As I said, the sort for the document list is not by character, it is by collation rules, the filebrowser uses case insensitive character order.
I created those 4 names in /tmp and they sort the same way in the system file manager, so its not unreasonable to expect the Geany document list to be the same since users are used to seeing files in that order. The filebrowser plugin sorts in a different order and by that measure could be seen as wrong.
I havn't studied the Unicode collating algorithm, but I would suspect that underscores may be ignored giving the order `c cc ccrs crs` as seen in documents and system filemanager.
As I explained, the two orderings are appropriate for different use-cases. If somebody wanted to provide a PR adding an option for changing the ordering for documents and filebrowser in their right click menus (similar to the sort options in the symbols tab) then both use-cases could be supported by both.
yes, i see now that the Geany plugin file browser AND my Linux file system file browser both sort file names the way you say, but not like the default Geany document browser. Regarding the dual sort support you propose, I think that character base sorting in the Geany document browser, regardless of char bit length, would be the preferred default mode for all languages, and would be a VERY useful feature. tks for explaining this issue and a possible Geany improvement so quickly!
wow, i just spent over an hour TRYING to devise a file(s) naming scheme that would clearly sort in the default Geany document browser to convey the nested php function that these nested php file groups perform. Impossible! I plan on having a dozen of nested php files requiring clear alphabetized group sorting to open the files frequently for editing. Looks like i need the Geany improvement suggested above by elextr, as soon as possible! tks
github-comments@lists.geany.org