@@ -363,15 +363,15 @@ helpWidget = (helpKeys <=> fill ' ') <+> (helpCommands <=> fill ' ')
363
363
]
364
364
365
365
helpRecipes :: Int -> [Recipe Entity ] -> Widget Name
366
- helpRecipes count xs = viewport RecipesViewport Vertical (vBox recipesLists)
366
+ helpRecipes count xs = viewport RecipesViewport Vertical (padTop ( Pad 1 ) $ vBox recipesLists)
367
367
where
368
368
(news, knowns) = splitAt count xs
369
369
recipesLists = drawRecipes news <> sepRecipes <> drawRecipes knowns
370
370
drawRecipes = map (padLeftRight 18 . padBottom (Pad 1 ) . drawRecipe Nothing Nothing )
371
371
-- TODO: figure out how to make the whole hBorder to be red, not just the label
372
372
sepRecipes
373
373
| count > 0 && not (null knowns) =
374
- [ padBottom (Pad 1 ) (withAttr " red " $ hBorderWithLabel (padLeftRight 1 (txt " new↑" )))
374
+ [ padBottom (Pad 1 ) (withAttr redAttr $ hBorderWithLabel (padLeftRight 1 (txt " new↑" )))
375
375
]
376
376
| otherwise = []
377
377
@@ -392,6 +392,7 @@ drawKeyMenu s =
392
392
. (++ [gameModeWidget])
393
393
. map (padLeftRight 1 . drawKeyCmd)
394
394
. (globalKeyCmds ++ )
395
+ . map (\ (k, n) -> (NoHighlight , k, n))
395
396
. keyCmdsFor
396
397
. focusGetCurrent
397
398
. view (uiState . uiFocusRing)
@@ -405,11 +406,11 @@ drawKeyMenu s =
405
406
406
407
availRecipes
407
408
| null (s ^. gameState . availableRecipes) = []
408
- | otherwise = [( " F2 " , knownMark (s ^. gameState . availableRecipesNewCount) <> " Recipes " )]
409
-
410
- knownMark count
411
- | count > 0 = " * "
412
- | otherwise = " "
409
+ | otherwise =
410
+ let highlight
411
+ | s ^. gameState . availableRecipesNewCount > 0 = Highlighted
412
+ | otherwise = NoHighlight
413
+ in [(highlight, " F2 " , " Recipes " )]
413
414
414
415
gameModeWidget =
415
416
padLeft Max . padLeftRight 1
@@ -419,7 +420,10 @@ drawKeyMenu s =
419
420
False -> " Classic"
420
421
True -> " Creative"
421
422
globalKeyCmds =
422
- [(" F1" , " help" )] <> availRecipes <> [(" Tab" , " cycle" )] <> [(" ^k" , " creative" ) | cheat]
423
+ [(NoHighlight , " F1" , " help" )]
424
+ <> availRecipes
425
+ <> [(NoHighlight , " Tab" , " cycle" )]
426
+ <> [(NoHighlight , " ^k" , " creative" ) | cheat]
423
427
424
428
keyCmdsFor (Just REPLPanel ) =
425
429
[ (" ↓↑" , " history" )
@@ -445,9 +449,12 @@ drawKeyMenu s =
445
449
]
446
450
keyCmdsFor _ = []
447
451
452
+ data KeyHighlight = NoHighlight | Highlighted
453
+
448
454
-- | Draw a single key command in the menu.
449
- drawKeyCmd :: (Text , Text ) -> Widget Name
450
- drawKeyCmd (key, cmd) = txt $ T. concat [" [" , key, " ] " , cmd]
455
+ drawKeyCmd :: (KeyHighlight , Text , Text ) -> Widget Name
456
+ drawKeyCmd (Highlighted , key, cmd) = hBox [withAttr notifAttr (txt $ T. concat [" [" , key, " ] " ]), txt cmd]
457
+ drawKeyCmd (NoHighlight , key, cmd) = txt $ T. concat [" [" , key, " ] " , cmd]
451
458
452
459
------------------------------------------------------------
453
460
-- World panel
0 commit comments