Skip to content

Commit

Permalink
Legend for colorization in F1 dialog (#2175)
Browse files Browse the repository at this point in the history
Closes #2173.

Demo of <kbd>F1</kbd> dialog:
![Screenshot from 2024-10-13 18-51-00](https://github.com/user-attachments/assets/2c9f37ba-b795-4e5f-aa33-c9f4ad33de41)
  • Loading branch information
kostmo authored Oct 14, 2024
1 parent 188ff6b commit 3c03a24
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/swarm-tui/Swarm/TUI/View.hs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,13 @@ drawModal s = \case

helpWidget :: Seed -> Maybe Port -> KeyEventHandlingState -> Widget Name
helpWidget theSeed mport keyState =
padLeftRight 2 . vBox $ padTop (Pad 1) <$> [info, helpKeys, tips]
padLeftRight 2 . vBox $
padTop (Pad 1)
<$> [ info
, colorizationLegend
, helpKeys
, tips
]
where
tips =
vBox
Expand All @@ -660,6 +666,12 @@ helpWidget theSeed mport keyState =
, txt ("Seed: " <> into @Text (show theSeed))
, txt ("Web server port: " <> maybe "none" (into @Text . show) mport)
]
colorizationLegend =
vBox
[ heading boldAttr "Colorization legend"
, drawMarkdown
"In text, snippets of code like `3 + 4` or `scan down` will be colorized. Types like `Cmd Text`{=type} have a dedicated color. The names of an `entity`{=entity}, a `structure`{=structure}, and a `tag`{=tag} also each have their own color."
]
helpKeys =
vBox
[ heading boldAttr "Keybindings"
Expand Down

0 comments on commit 3c03a24

Please sign in to comment.