tomboy-notes / tomboy-ng

Next generation of Tomboy
MIT License
389 stars 38 forks source link

Add sorting of notebooks for display #192

Closed erik-brangs closed 4 years ago

erik-brangs commented 4 years ago

I would like to have the display of my notebooks sorted by notebook title. As of tomboy-ng 0.29, notebooks seem to be displayed in an arbitrary order.

davidbannon commented 4 years ago

Yeah, thats a real oversight I must admit. That section has been completely rewritten and I missed sorting. What I will do is, initially, sort alphabetically 'a' at the top, and have an option to reverse that sort, 'z' at the top.
Thinking out loud .... The next release does away with the notebook options button, you now, more intuitively, right click an entry. But all existing options apply only to the clicked notebook. So, changing sort directions that way is not right, maybe its done from the label at the top of the notebook list ? Anyway, sorry Erik, I should have spotted that. Davo

davidbannon commented 4 years ago

OK, fixed that. The the list is now sorted, 'a' at the top.
But I cannot make it reverse that sort easily, if we need to be able to reverse the sort with a click, I'll need to replace the TListBox with a TListView, its not quite as fast.

erik-brangs commented 4 years ago

Thank you.

What's the behaviour of the sorting for characters like ü and ß that occur in German texts (i.e. collation)? I'm currently not using those characters at the start of my notebook names but I might want too in the future.

With respect to sorting options, I suppose sorting by most recently changed notebook could also be useful.

davidbannon commented 4 years ago

Erik, thats a very interesting question (an response we all know means I don't know the answer to your question). So I tried it and to my surprise, a word starting with ß pops up between ones starting with 'P' and 'T'. LCL stores all characters as unicode, the ascii set is just the 'single byte unicode' character set. So ß is (guessing) a two byte one and the first byte is 255. So in a list sorted using the first byte first, the ß word would appear at the end of the list if it was just a numerical sort.
So, the sorting algorithm is more elaborate than that, it is not case sensitive (with ascii) and appears to have made a deliberate decision to locate ß between 'P' and 'T'. Further research is indicted ....

WRT sorting on last change date of the member notes, that would definitly require replacing TListBox. As TListBox is a lot faster with large note collections, I am thinking thats only a good idea if we really need that extra sorting capability. Thoughts ?

Davo

erik-brangs commented 4 years ago

I'm happy that the sorting seems to work in a sensible way.

If TListBox is faster, I'd prefer to keep it. I can do without sorting by recently changed notebook or other complex sorting options.

davidbannon commented 4 years ago

OK, just for for the record, Notebook names starting with a unicode character (such as the ß Erik mentions) are sorted as if the unicode char does not exist. So ßaaa would be at the top and ßzzz would be at the bottom.

This is, in my humble opinion a bug and and I will follow it up with the LCL people .

Davo

davidbannon commented 4 years ago

This is fixed in v0.30