timeline: fix timestamp binary search

Fixes dragging the mouse over bigger gaps of log activity making the red
position rectangle come out next to the mouse pointer. Also selects the proper
row now, not randomly 1-2 rows before or after the gap.
This commit is contained in:
René Stadler 2009-06-13 00:58:36 +03:00 committed by Stefan Sauer
parent 3a90836f82
commit 7b57fe2423

View file

@ -60,12 +60,12 @@ class LineFrequencySentinel (object):
while True: while True:
middle = (last_index - first_index) // 2 + first_index middle = (last_index - first_index) // 2 + first_index
if middle == first_index: if middle == first_index:
return last_index return first_index
ts = model_get (model_iter_nth_child (None, middle), col_id) ts = model_get (model_iter_nth_child (None, middle), col_id)
if ts < target_ts: if ts < target_ts:
first_index = middle + 1 first_index = middle
elif ts > target_ts: elif ts > target_ts:
last_index = middle - 1 last_index = middle
else: else:
return middle return middle