From 7b57fe2423bd9e0c35949f80aead94bc6a6f8ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Sat, 13 Jun 2009 00:58:36 +0300 Subject: [PATCH] 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. --- debug-viewer/GstDebugViewer/Plugins/Timeline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debug-viewer/GstDebugViewer/Plugins/Timeline.py b/debug-viewer/GstDebugViewer/Plugins/Timeline.py index 1d11614ab7..c4e5c377b4 100644 --- a/debug-viewer/GstDebugViewer/Plugins/Timeline.py +++ b/debug-viewer/GstDebugViewer/Plugins/Timeline.py @@ -60,12 +60,12 @@ class LineFrequencySentinel (object): while True: middle = (last_index - first_index) // 2 + first_index if middle == first_index: - return last_index + return first_index ts = model_get (model_iter_nth_child (None, middle), col_id) if ts < target_ts: - first_index = middle + 1 + first_index = middle elif ts > target_ts: - last_index = middle - 1 + last_index = middle else: return middle