~allanlesage/indicator-appmenu/TDD-fixes

Viewing all changes in revision 202.1.1.

  • Committer: Ryan Lortie
  • Date: 2012-04-11 13:43:30 UTC
  • mto: This revision was merged to the branch mainline in revision 203.
  • Revision ID: desrt@desrt.ca-20120411134330-l0esd53ff2pkc1oh
hud: never allow perfect match for indicators

The old scoring algorithm would assign a penalty of one for searching
for "item" and finding "Item" (due to the case).  The new algorithm
ignores case.

This caused an unintended problem: the fact that we would never get
perfect matches (due to the fact that nobody ever properly capitalised
their search strings) was a good thing.  The indicator penalty is
expressed as a percentage by which to increase whatever the distance
already was, and that doesn't work well with the now-common case of a
perfect match (since 0 + 50% is still 0).

We tweak this situation by never allowing a match from an indicator have
a perfect score.  If the indicator penalty is requested, then the
distance must be at least 1.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: