@@ -350,37 +350,21 @@ eventLoop uienv@UIEnv{..} eventlogState = do
350350 dispatch (EventCursorChangedIndex cursorPos') EventlogLoaded {hecs} = do
351351 let cursorTs' = eventIndexToTimestamp hecs cursorPos'
352352 selection' = PointSelection cursorTs'
353- timelineSetSelection timelineWin selection'
354- eventsViewSetCursor eventsView cursorPos' Nothing
355- continueWith eventlogState {
356- selection = selection',
357- cursorPos = cursorPos'
358- }
353+ mselection <- timelineSetSelection timelineWin selection'
354+ setSelection cursorPos' Nothing mselection
359355
360356 dispatch (EventCursorChangedSelection selection'@ (PointSelection cursorTs'))
361357 EventlogLoaded {hecs} = do
362358 let cursorPos' = timestampToEventIndex hecs cursorTs'
363- timelineSetSelection timelineWin selection'
364- eventsViewSetCursor eventsView cursorPos' Nothing
365- histogramViewSetInterval histogramView Nothing
366- summaryViewSetInterval summaryView Nothing
367- continueWith eventlogState {
368- selection = selection',
369- cursorPos = cursorPos'
370- }
359+ mselection <- timelineSetSelection timelineWin selection'
360+ setSelection cursorPos' Nothing mselection
371361
372362 dispatch (EventCursorChangedSelection selection'@ (RangeSelection start end))
373363 EventlogLoaded {hecs} = do
374364 let cursorPos' = timestampToEventIndex hecs start
375365 mrange = Just (cursorPos', timestampToEventIndex hecs end)
376- timelineSetSelection timelineWin selection'
377- eventsViewSetCursor eventsView cursorPos' mrange
378- histogramViewSetInterval histogramView (Just (start, end))
379- summaryViewSetInterval summaryView (Just (start, end))
380- continueWith eventlogState {
381- selection = selection',
382- cursorPos = cursorPos'
383- }
366+ mselection <- timelineSetSelection timelineWin selection'
367+ setSelection cursorPos' mrange mselection
384368
385369 dispatch (EventTracesChanged traces) _ = do
386370 timelineWindowSetTraces timelineWin traces
@@ -435,6 +419,24 @@ eventLoop uienv@UIEnv{..} eventlogState = do
435419 async doing action =
436420 forkIO (action `catch` \ e -> post (EventUserError doing e))
437421
422+ setSelection cursorPos' _ (Just selection'@ (PointSelection _)) = do
423+ eventsViewSetCursor eventsView cursorPos' Nothing
424+ histogramViewSetInterval histogramView Nothing
425+ summaryViewSetInterval summaryView Nothing
426+ continueWith eventlogState {
427+ selection = selection',
428+ cursorPos = cursorPos'
429+ }
430+ setSelection cursorPos' mrange (Just selection'@ (RangeSelection start end)) = do
431+ eventsViewSetCursor eventsView cursorPos' mrange
432+ histogramViewSetInterval histogramView (Just (start, end))
433+ summaryViewSetInterval summaryView (Just (start, end))
434+ continueWith eventlogState {
435+ selection = selection',
436+ cursorPos = cursorPos'
437+ }
438+ setSelection _ _ Nothing = continue
439+
438440 post = postEvent eventQueue
439441 continue = continueWith eventlogState
440442 continueWith = return . Right
0 commit comments