Make debug display look better :P

This commit is contained in:
Joscha 2020-02-09 12:08:48 +00:00
parent 573a835022
commit 31e59616f5

View file

@ -3,6 +3,8 @@
module Main where module Main where
import Brick import Brick
import Brick.Widgets.Border
import Brick.Widgets.Border.Style
import Control.Concurrent.Chan import Control.Concurrent.Chan
import Control.Exception import Control.Exception
import Control.Monad import Control.Monad
@ -51,11 +53,10 @@ newClientState node = ClientState
} }
clientDraw :: ClientState -> [Widget ResourceName] clientDraw :: ClientState -> [Widget ResourceName]
clientDraw cs = clientDraw cs = [joinBorders $ withBorderStyle unicode $ debug <=> tree]
[ renderTree boxDrawingBranching (csEditor cs) (csTree cs) <=> where
txt "--------------------------------------------------------------------------------" <=> tree = borderWithLabel (txt "Tree") $ renderTree boxDrawingBranching (csEditor cs) (csTree cs)
txtWrap (T.pack $ show $ csTree cs) debug = borderWithLabel (txt "Debug") $ hLimit 80 $ txtWrap $ T.pack $ show $ csTree cs
]
isQuitEvent :: BrickEvent a b -> Bool isQuitEvent :: BrickEvent a b -> Bool
isQuitEvent (VtyEvent (Vty.EvKey (Vty.KChar 'q') [])) = True isQuitEvent (VtyEvent (Vty.EvKey (Vty.KChar 'q') [])) = True