Merge lp:~yeganeh/unity/fix-for-862996 into lp:unity

Proposed by Zaid Yeganeh
Status: Merged
Merged at revision: 1717
Proposed branch: lp:~yeganeh/unity/fix-for-862996
Merge into: lp:unity
Diff against target: 35 lines (+18/-3)
1 file modified
UnityCore/MultiRangeFilter.cpp (+18/-3)
To merge this branch: bzr merge lp:~yeganeh/unity/fix-for-862996
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+78676@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Awesome, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UnityCore/MultiRangeFilter.cpp'
2--- UnityCore/MultiRangeFilter.cpp 2011-08-05 19:25:57 +0000
3+++ UnityCore/MultiRangeFilter.cpp 2011-10-07 22:13:25 +0000
4@@ -111,14 +111,29 @@
5 }
6 else
7 {
8- // It's in the middle of the range. See which side to shorten.
9- if (position < (right_pos_/2.0f))
10+ // Reset if the one and only block is deactivated
11+ if (position == right_pos_ && position == left_pos_)
12+ {
13+ left_pos_ = -1;
14+ right_pos_ = -1;
15+ }
16+ // If the deactivated block is on either end, remove it
17+ else if (position == right_pos_)
18+ {
19+ right_pos_ = position - 1;
20+ }
21+ else if (position == left_pos_)
22 {
23 left_pos_ = position + 1;
24 }
25+ // It's in the middle of the range, see which side to shorten
26+ else if (position < (left_pos_ + ((right_pos_ - left_pos_)/2.0f)))
27+ {
28+ left_pos_ = position;
29+ }
30 else
31 {
32- right_pos_ = position - 1;
33+ right_pos_ = position;
34 }
35 }
36