-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
menu@cinnamon.org: Allow items to be re-ordered to better reflect
the search outcome. - The app buttons have always been sorted prior to having their actors added to their container. As a result, their original order within the app box can always be restored. - When a search is made, an index is assigned to resulting items, corresponding to the position of the pattern within the search string. The four app search strings (name, keywords, description, id) are weighted, so name matches come before keywords, and so on. - Places will always display after apps, and recents after places, maintaining their original respective positions. Sorting is done simply by comparing the search indices for all matching buttons: Examples: - Given two apps with with the names "Files" and "The File Manager" with "file" as the search string, "File" has a match value of 0 (matched at the start of the name string) and "The File Manager" has an index of 4 (position 4), so "File" will appear before "The File Manager" in the search results. - Given two apps with matches of "File" in the name for one, and "browse,file,manage" in the keywords of the second, the first will have a match value of 0 and the second will have a value of 1007. Taking the second example further, a match in the description would have a value >= 2000, and the app id would be >= 3000. Recents and places share a 4000 base value - they will always appear after any apps in the search results. Ties are broken by alphabetic sorting of the app name (which will always be unique). Performance appears to be little affected when searching, and there shouldn't be much imact at all on normal non-search operation of the applet.
- Loading branch information
Showing
1 changed file
with
123 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters