From 31e59616f59395874d2f96237dfc00cb996fe7aa Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 9 Feb 2020 12:08:48 +0000 Subject: [PATCH] Make debug display look better :P --- client/Main.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/Main.hs b/client/Main.hs index 58715dd..b47e6e4 100644 --- a/client/Main.hs +++ b/client/Main.hs @@ -3,6 +3,8 @@ module Main where import Brick +import Brick.Widgets.Border +import Brick.Widgets.Border.Style import Control.Concurrent.Chan import Control.Exception import Control.Monad @@ -51,11 +53,10 @@ newClientState node = ClientState } clientDraw :: ClientState -> [Widget ResourceName] -clientDraw cs = - [ renderTree boxDrawingBranching (csEditor cs) (csTree cs) <=> - txt "--------------------------------------------------------------------------------" <=> - txtWrap (T.pack $ show $ csTree cs) - ] +clientDraw cs = [joinBorders $ withBorderStyle unicode $ debug <=> tree] + where + tree = borderWithLabel (txt "Tree") $ renderTree boxDrawingBranching (csEditor cs) (csTree cs) + debug = borderWithLabel (txt "Debug") $ hLimit 80 $ txtWrap $ T.pack $ show $ csTree cs isQuitEvent :: BrickEvent a b -> Bool isQuitEvent (VtyEvent (Vty.EvKey (Vty.KChar 'q') [])) = True @@ -71,7 +72,7 @@ isFocusUpEvent _ = False isToggleFoldEvent :: BrickEvent a b -> Bool isToggleFoldEvent (VtyEvent (Vty.EvKey (Vty.KChar '\t') [])) = True -isToggleFoldEvent _ = False +isToggleFoldEvent _ = False clientHandleEvent :: ClientState -> BrickEvent ResourceName () -> EventM ResourceName (Next ClientState) clientHandleEvent cs e