about summary refs log tree commit diff
path: root/users/aspen/xanthous/src/Xanthous/Entities/Draw/Util.hs
blob: aa6c5fa4fc47b82fe820613eb6e3aac192dd025d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Xanthous.Entities.Draw.Util where
--------------------------------------------------------------------------------
import Xanthous.Prelude
--------------------------------------------------------------------------------
import Brick.Widgets.Border.Style
import Brick.Types (Edges(..))
--------------------------------------------------------------------------------

borderFromEdges :: BorderStyle -> Edges Bool -> Char
borderFromEdges bstyle edges = ($ bstyle) $ case edges of
  Edges False False  False False -> const '☐'

  Edges True  False  False False -> bsVertical
  Edges False True   False False -> bsVertical
  Edges False False  True  False -> bsHorizontal
  Edges False False  False True  -> bsHorizontal

  Edges True  True   False False -> bsVertical
  Edges True  False  True  False -> bsCornerBR
  Edges True  False  False True  -> bsCornerBL

  Edges False True   True  False -> bsCornerTR
  Edges False True   False True  -> bsCornerTL
  Edges False False  True  True  -> bsHorizontal

  Edges False True   True  True  -> bsIntersectT
  Edges True  False  True  True  -> bsIntersectB
  Edges True  True   False True  -> bsIntersectL
  Edges True  True   True  False -> bsIntersectR

  Edges True  True   True  True  -> bsIntersectFull