Merge lp:~desrt/indicator-appmenu/no-zero-indicator-penalty into lp:indicator-appmenu/0.4

Proposed by Allison Karlitskaya
Status: Merged
Approved by: Charles Kerr
Approved revision: 203
Merged at revision: 203
Proposed branch: lp:~desrt/indicator-appmenu/no-zero-indicator-penalty
Merge into: lp:indicator-appmenu/0.4
Diff against target: 12 lines (+3/-0)
1 file modified
src/hudresult.c (+3/-0)
To merge this branch: bzr merge lp:~desrt/indicator-appmenu/no-zero-indicator-penalty
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+101556@code.launchpad.net

Description of the change

    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.

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

looks good.

Thanks for the good description, too...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/hudresult.c'
2--- src/hudresult.c 2012-03-31 03:54:13 +0000
3+++ src/hudresult.c 2012-04-11 13:53:19 +0000
4@@ -201,6 +201,9 @@
5
6 result->distance += (result->distance * penalty) / 100;
7
8+ if (result->distance == 0 && penalty > 0)
9+ result->distance = 1;
10+
11 return result;
12 }
13

Subscribers

People subscribed via source and target branches