scripts icon indicating copy to clipboard operation
scripts copied to clipboard

go.py: sort option issues

Open sim642 opened this issue 6 years ago • 0 comments

A week ago I was messing around with the plugins.var.python.go.sort option and noticed some issues/weird things:

  1. The option's help text is incomplete, the source code contains a complete version. The fault seems to be an unnecessary comma here: https://github.com/weechat/scripts/blob/7f70640b30e61d8f4d9fd8ea4595bc2f947602b6/python/go.py#L142

  2. The beginning sort key has extra functionality to ignore a single #: https://github.com/weechat/scripts/blob/7f70640b30e61d8f4d9fd8ea4595bc2f947602b6/python/go.py#L250-L251 Freenode has channels beginning with ## so it'd make sense to ignore more than one, or possibly even other special symbols.

  3. The number sort key has a very misleading name because it doesn't sort by buffer numbers but rather whether the current searched text exactly matches the buffer's number: https://github.com/weechat/scripts/blob/7f70640b30e61d8f4d9fd8ea4595bc2f947602b6/python/go.py#L372-L374 When searching by text, this doesn't happen but it still might be desirable to sort the possible results by their buffer numbers.

  4. The order of sort keys is reverse compared to everything else (buflist.look.sort, fset.look.sort, script.look.sort). Everywhere else, the sort keys are used lexicographically (the most important key is the first, if those are equal sort by second key, etc) but go.py does the sorts in that order: https://github.com/weechat/scripts/blob/7f70640b30e61d8f4d9fd8ea4595bc2f947602b6/python/go.py#L387-L389 This actually means that the last sort key is the most important because that's the last one which is sorted by.

sim642 avatar May 06 '19 15:05 sim642