From 5262d942c4c2c36529fbe704e7de165044e6dc99 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 31 Dec 2024 11:43:49 +0530 Subject: Add timing measurement for each section of screen --- src/Chelleport/View.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Chelleport/View.hs') diff --git a/src/Chelleport/View.hs b/src/Chelleport/View.hs index 314aa39..369b93d 100644 --- a/src/Chelleport/View.hs +++ b/src/Chelleport/View.hs @@ -27,13 +27,16 @@ getSearchText state (ModeSearchData {searchInputText, searchFilteredWords, searc renderSearchView :: (MonadDraw m) => State -> ModeSearchData -> m () renderSearchView state searchData@(ModeSearchData {searchFilteredWords, searchHighlightedIndex}) = do renderGridLines state + mapM_ highlightWord $ zip [0 ..] searchFilteredWords + drawSearchText + where + highlightWord (index, OCRMatch {matchStartX, matchStartY, matchEndX, matchEndY}) = do + setDrawColor $ if searchHighlightedIndex == index then colorAccent else colorLightGray + fillRectVertices (matchStartX, matchStartY) (matchEndX, matchEndY) - forM_ (zip [0 ..] searchFilteredWords) $ \(index, OCRMatch {matchStartX, matchStartY, matchEndX, matchEndY}) -> do - setDrawColor $ if searchHighlightedIndex == index then colorAccent else colorLightGray - fillRectVertices (matchStartX, matchStartY) (matchEndX, matchEndY) - - (w, h) <- windowSize - void $ drawText (w `div` 2, 5 + h `div` 2) searchingTextStyle (Text.pack $ getSearchText state searchData) + drawSearchText = do + (w, h) <- windowSize + void $ drawText (w `div` 2, 5 + h `div` 2) searchingTextStyle (Text.pack $ getSearchText state searchData) renderHintsView :: (MonadDraw m) => State -> ModeHintsData -> m () renderHintsView state (ModeHintsData {stateGrid, stateKeySequence, stateIsMatched}) = do -- cgit v1.3.1