aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport/View.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-21 16:37:24 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-21 16:49:42 +0530
commit87815edbab70302793fb83259fedc1ae9004d172 (patch)
treee434cc57bff80f7e8a739db9349225f57e82d2d8 /src/Chelleport/View.hs
parent217f38ad33811c88c63ff4c0be387e67fb0cd68a (diff)
downloadchelleport-87815edbab70302793fb83259fedc1ae9004d172.tar.gz
chelleport-87815edbab70302793fb83259fedc1ae9004d172.zip
Optimize initialization time
Diffstat (limited to 'src/Chelleport/View.hs')
-rw-r--r--src/Chelleport/View.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Chelleport/View.hs b/src/Chelleport/View.hs
index 4007bdc..069e49c 100644
--- a/src/Chelleport/View.hs
+++ b/src/Chelleport/View.hs
@@ -22,7 +22,7 @@ render state = do
when visible $ do
renderTargetPoints state (rowIndex, colIndex)
-renderKeySequence ::(MonadDraw m) => KeySequence -> Cell -> (CInt, CInt) -> m Bool
+renderKeySequence :: (MonadDraw m) => KeySequence -> Cell -> (CInt, CInt) -> m Bool
renderKeySequence keySequence cell (px, py) = do
let (matched, remaining)
| keySequence `isPrefixOf` cell = splitAt (length keySequence) cell
@@ -33,9 +33,10 @@ renderKeySequence keySequence cell (px, py) = do
| isNotEmpty matched = Just colorHighlight
| otherwise = Nothing
- previousTextWidth <- if isNotEmpty matched
- then fst <$> drawText (px, py) colorLightGray (Text.pack matched)
- else pure 0
+ previousTextWidth <-
+ if isNotEmpty matched
+ then fst <$> drawText (px, py) colorLightGray (Text.pack matched)
+ else pure 0
when (isNotEmpty remaining) $ case textColor of
Just color -> do
@@ -67,7 +68,7 @@ renderGridLines state = do
drawHorizontalLine (rows * hcell `div` 2)
drawVerticalLine (columns * wcell `div` 2)
-renderTargetPoints :: (MonadDraw m) =>State -> (CInt, CInt) -> m ()
+renderTargetPoints :: (MonadDraw m) => State -> (CInt, CInt) -> m ()
renderTargetPoints state (row, col) = do
(wcell, hcell) <- cellSize state
let (x, y) = (col * wcell + wcell `div` 2, row * hcell + hcell `div` 2)