Skip to content

Commit

Permalink
Merge branch 'main' of github.com:AidanV/mtc
Browse files Browse the repository at this point in the history
  • Loading branch information
AidanV committed Jun 27, 2024
2 parents 9058608 + d6c4489 commit 442ab80
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,24 @@ drawUI :: St -> [T.Widget Name]
drawUI st = [ui]
where
e1 = F.withFocusRing (st ^. focusRing) (E.renderEditor (str . unlines)) (st ^. editEquation)
merge :: [a] -> [a] -> [a]
merge xs [] = xs
merge [] ys = ys
merge (_ : xs) (y : ys) = y : merge xs ys
ui =
C.center $
Brick.Widgets.Border.borderWithLabel
(str "Answers")
( Brick.Widgets.Core.padLeftRight
20
( Brick.Widgets.Core.padAll
1
(Brick.Widgets.Core.vBox $ zipWith (\i e -> str ([i] ++ ": " ++ e)) ['a' ..] (st ^. previousAnswers))
( hLimit
50
( Brick.Widgets.Core.padLeftRight
15
case st ^. previousAnswers of
[] -> str " "
prevAns -> Brick.Widgets.Core.vBox $ zipWith (\i e -> str ([i] ++ ": " ++ e)) ['a' ..] $ map (reverse . merge (replicate 16 ' ') . reverse) prevAns
)
)
<=> Brick.Widgets.Border.border (str "= " <+> hLimit 30 e1)
<=> Brick.Widgets.Border.border (str "= " <+> hLimit 48 e1)

appEvent :: T.BrickEvent Name e -> T.EventM Name St ()
appEvent (T.VtyEvent (V.EvKey V.KEsc [])) =
Expand Down

0 comments on commit 442ab80

Please sign in to comment.