Page MenuHome

UI: implement a better selection rule for the search box.
Needs ReviewPublic

Authored by Alexander Gavrilov (angavrilov) on Thu, Jun 11, 12:51 PM.



Currently the search box selects the first item in the list that
matches the string. It is a simple behavior, but it actually doesn't
act that intuitively, and can result in wrong Paste behavior by
choosing an alphabetically earlier long item over an exact match.

This attempts to improve the behavior by trying to minimize the
length of the prefix before the match, and alphabetically comparing
the tail just in case the list isn't sorted. Overall this should
prefer the shortest match, with some weight given to word boundaries.

For example, given "ACube12", "BCube1" and "Cube", it will prefer
"Cube" when searching for "Cube", and "BCube1" when searching for

Diff Detail

rB Blender
temp-angavrilov-search-selection (branched from master)
Build Status
Buildable 8503
Build 8503: arc lint + arc unit

Event Timeline

Alexander Gavrilov (angavrilov) requested review of this revision.Thu, Jun 11, 12:51 PM
Alexander Gavrilov (angavrilov) created this revision.

I'm open for suggestions of a better or more intuitive heuristic - I only have a vague idea that it should in general prefer a shorter match as that is 'less guessing' from the computer; and it shouldn't just be a special case for an exact match, because using the search by manually typing is being annoying by selecting an unintended match too.