Commit Graph

2 Commits

Author SHA1 Message Date
Jacques Lucke
09e6ebb5f0 UI: support different main word heuristics in string search
Currently, we always prioritize the words in the last section of a search item
(the words that are highlighted). This generally works well, but the situation
is a bit different for link-drag-search, because there the last part is the socket
name, which is usually less descriptive than the node name.

This patch allows us to use different heuristics to select the prioritized section
per search.

Unfortunately, the link-drag-search is not fully consistent with itself. Sometimes
the last group is a socket name, but sometimes it's also the mode of a node
(`Math > Add`). Therefore, the patch currently simply prioritizes all words in the
same instead of prioritizing only the first part. This seems to work much better
than before even if not perfect in all cases yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/113648
2023-10-20 13:50:10 +02:00
Jacques Lucke
8362563949 UI: show recently selected items at the top of searches
The goal is to make the search faster to use by dynamically adapting to the user.
This can be achieved using the simple but common approach of showing recently
selected items at the top. Note, that the "matching score" between the query and
each search item still has precedence when determining the order. So the last used
item is only at the top, if there is no other search item that matches the query better.

Besides making the search generally faster to use, my hope is that this can also
reduce the need for manually weighting search items in some places. This is
because while the ordering might not be perfect the first time, it will always be
once the user selected the element that should be at the top once.

This patch includes:
* Support for taking recent searches into account in string searching.
* Keep track of a global list of recent searches.
* Store recent searches on disk similar to recently opened files.
* A new setting in the user preferences that allows disabling the functionality.
  This can be used if deterministic key strokes are required, e.g. for automated tests.

In the future this could be improved in different ways:
* Add some kind of separator in the search list to indicate which elements are at
  the top because they have been used recently.
* Store the recent search items per search, instead of in a global list. This way
  it could adapt to the user even better.

Pull Request: https://projects.blender.org/blender/blender/pulls/110828
2023-09-25 10:56:12 +02:00