[ZeroBrane Studio] Re: Outline sorting - disable locale

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Tue, 13 Sep 2016 14:34:05 -0700

Hi Mattes,

I was wondering if anyone knows of a way to disable locale-based sorting in 
the ZBS outline tree, and use ascii-sorting, or simple natural sorting 
(number / ascii-char chunks) instead.

ZBS uses SortChildren method of wxTreeCtrl to sort, so it doesn't have
much control over how it's done (and can't replace it with a custom
"compare" function as it's not exposed in wxlua).

Note that the Project filelist tree actually uses a different sorting method, 
one that seems to be smarter, though not yet there: It ignores the "ch" 
stupidity of my locale, but sorts numbers this way:

The list of files is sorted in Lua, so probably uses a different algorithm.

I can probably add a custom sorting to the project filelist, which you
can then use to provide your own sort function (maybe one of the
number friendly ones from this list:
http://notebook.kulchenko.com/algorithms/alphanumeric-natural-sorting-for-humans-in-lua),
but it's trickier for the outline as it's recalculated/resorted every
time the functions change. I'll take a look if I can make it work, but
maybe it's simpler to set the locale (to a better one) before
launching the IDE?

Paul.

Other related posts: